#18912 [NEW]: pg_pconnect opens a new connection even when and old one is available

From: Date: Thu, 15 Aug 2002 07:03:11 +0000
Subject: #18912 [NEW]: pg_pconnect opens a new connection even when and old one is available
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16884@lists.php.net to get a copy of this message
From: jc@mega-bucks.co.jp Operating system: Red Hat Linux 7.2 PHP version: 4.2.2 PHP Bug Type: PostgreSQL related Bug description: pg_pconnect opens a new connection even when and old one is available When I use pg_pconnect() I find that sometimes PHP creates a connection even if the is alrady a currently open one. This only happens *sometimes*. For example I reload my test code multiple times and I see no problem. However If I then load a new page, hit the back button and then re-load the test code I now see two open postgres connection where I only saw one before. # ps -auxw | grep idle root 3 0.0 0.0 0 0 ? SW 13:05 0:00 [kapm-idled] postgres 1409 0.0 0.4 6544 2208 ? S 15:53 0:00 postgres: postgres JC [local] idle postgres 1453 0.5 0.4 6544 2208 ? S 15:55 0:00 postgres: postgres JC [local] idle I use this code: <?php $sql = "select now()"; $res = sql_query($sql); $dat = pg_fetch_object($res); echo "$dat->now<br>"; function sql_query($sql) { //echo "$sql<br>"; $conn = pg_pconnect("dbname=JC user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query ($sql)<br>"; die; } else { return $res; } } ?> ~ -- Edit bug report at http://bugs.php.net/?id=18912&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18912&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18912&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18912&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18912&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18912&r=support Expected behavior: http://bugs.php.net/fix.php?id=18912&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18912&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18912&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18912&r=globals

« previous php.bugs (#16884) next »