#40544 [NEW]: PostgreSQL connection hangs after die()
| From: | kees at tweakers dot net | Date: | Mon, 19 Feb 2007 14:57:19 +0000 |
| Subject: | #40544 [NEW]: PostgreSQL connection hangs after die() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-109111@lists.php.net to get a copy of this message | ||
From: kees at tweakers dot net
Operating system: Linux (Debian)
PHP version: 5.2.1
PHP Bug Type: PostgreSQL related
Bug description: PostgreSQL connection hangs after die()
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 bug report at http://bugs.php.net/?id=40544&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40544&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40544&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40544&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40544&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40544&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40544&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40544&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40544&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40544&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40544&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40544&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40544&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40544&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40544&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40544&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40544&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40544&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40544&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40544&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40544&r=mysqlcfg