#40544 [Opn->Fbk]: PostgreSQL connection hangs after die()
| From: | tony2001@php.net | Date: | Mon, 19 Feb 2007 15:10:06 +0000 |
| Subject: | #40544 [Opn->Fbk]: PostgreSQL connection hangs after die() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109112@lists.php.net to get a copy of this message | ||
ID: 40544
Updated by: tony2001@php.net
Reported By: kees at tweakers dot net
-Status: Open
+Status: Feedback
Bug Type: PostgreSQL related
Operating System: Linux (Debian)
PHP Version: 5.2.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2007-02-19 14:57:19] kees at tweakers dot net
Description:
------------
After opening a db connection to postgresql and executing a query, and
after that query a 'die()' php doesnt return to the CLI but hangs
Reproduce code:
---------------
<?
$conn = pg_connect('user=acm dbname=loganalysis');
echo "Starting\n";
$q = "
CREATE TEMPORARY TABLE test (test integer);
COPY test FROM STDIN WITH DELIMITER ',' CSV QUOTE '\"' ESCAPE
'\"'";
pg_query($conn, $q);
die("And now he hangs in a busy wait\n");
?>
Expected result:
----------------
acm@abaris:~$ php test.3.php
Starting
And now he hangs in a busy wait
acm@abaris:~$
Actual result:
--------------
acm@abaris:~$ php test.3.php
Starting
And now he hangs in a busy wait
[no prompt, you have to ctrl-c to exit]
Last part of strace:
recv(3, "C\0\0\0\21CREATE TABLE\0G\0\0\0\t\0\0\1\0\0", 16384, 0) = 28
write(1, "And now he hangs in a busy wait\n", 32And now he hangs in a
busy wait
) = 32
close(6) = 0
close(5) = 0
close(4) = 0
He probably wants to do a close(3) here as that is the postgresql
connection, but it never closes, and netstat will show an open
connection:
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program
name Path
unix 3 [ ] STREAM CONNECTED 549701 -
/var/run/postgresql/.s.PGSQL.5432
unix 3 [ ] STREAM CONNECTED 549700 26884/php
Tested with PHP 5.2.0-8 (debian package) and PHP 4.4.2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40544&edit=1