#36469 [Asn->Fbk]: pg_get_result does not block

From: Date: Sun, 02 Nov 2008 12:31:21 +0000
Subject: #36469 [Asn->Fbk]: pg_get_result does not block
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130459@lists.php.net to get a copy of this message
ID: 36469 Updated by: jani@php.net Reported By: levi at alliancesoftware dot com dot au -Status: Assigned +Status: Feedback Bug Type: PostgreSQL related Operating System: FC3 PHP Version: 5.1.2 Assigned To: helly New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2006-02-23 02:35:30] levi at alliancesoftware dot com dot au I have tried and can repeat the error on the following: Fedora Core 2 (x86): PHP 5.0.4* PG 8.1* PHP 5.1.2* PG 8.1* Fedora Core 3 (x86-64): PHP 5.0.4** PG 8.1* PHP 5.1.2* PG 8.1* * = compiled from source ** = system RPM I also doublechecked that the connection only says its busy if the previous query had an error (ie change the query to a valid SELECT and it doesn't happen) ------------------------------------------------------------------------ [2006-02-22 10:57:52] tony2001@php.net What PG version are you using and did you try to upgrade it (and rebuild PHP with the upgraded libs) ? ------------------------------------------------------------------------ [2006-02-21 08:18:22] levi at alliancesoftware dot com dot au Description: ------------ According to the pg_connection_busy documentation, if pg_get_result is called on a pg_send_query that is currently executing, it should block until results become available. Occasionally this does not happen if the query had an error in it. Reproduce code: --------------- #!/usr/local/bin/php51 <?php $connStr = sprintf("host=%s dbname=%s user=%s password=%s", 'localhost', 'testdb', 'liam', 'liam'); $dbconn = pg_connect($connStr) or die("Could not connect"); $i = 0; while (!pg_connection_busy($dbconn)) { pg_send_query($dbconn, 'i am a syntax error'); pg_get_result($dbconn); $i++; } echo "got a busy signal after $i commands"; ?> Expected result: ---------------- (Loops forever) Actual result: -------------- got a busy signal after 221 commands (actual count varies, but always returns within 1 second. Approximately 1/3 of the time it gives a "happy" run and will loop forever) Note that if the SQL statement was a valid statement, I cannot get the erroneous behaviour to occur. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36469&edit=1

« previous php.bugs (#130459) next »