Bug #68360 [Csd->Nab]: PDO PgSQL doesn't disconnect as expected

From: Date: Mon, 09 Mar 2015 21:37:20 +0000
Subject: Bug #68360 [Csd->Nab]: PDO PgSQL doesn't disconnect as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191272@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68360&edit=1

 ID:                 68360
 Updated by:         aharvey@php.net
 Reported by:        ianbytchek at gmail dot com
 Summary:            PDO PgSQL doesn't disconnect as expected
-Status:             Closed
+Status:             Not a bug
 Type:               Bug
 Package:            PDO PgSQL
 Operating System:   OS X 10.10
 PHP Version:        5.6.2
 Block user comment: N
 Private report:     N

 New Comment:

No worries; thanks for getting back to us!


Previous Comments:
------------------------------------------------------------------------
[2015-03-07 18:04:27] ianbytchek at gmail dot com

This turned out to be caused by another framework (phalcon), sorry, wasn't the most obvious
thing. Tried without phalcon on the 5.6.6, works as expected.

------------------------------------------------------------------------
[2014-12-30 10:42:51] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

------------------------------------------------------------------------
[2014-11-07 12:55:16] aharvey@php.net

Are you sure that you don't have another reference to the object kicking around? What output do
you get if you call debug_zval_dump($pdo); immediately before setting it to NULL?

------------------------------------------------------------------------
[2014-11-06 07:05:23] ianbytchek at gmail dot com

Description:
------------
The comment http://php.net/manual/en/pdo.connections.php#114822
makes a very valid point. When we use the suggested method of dropping the connection by doing 

$pdo = null;

The connection doesn't get dropped as described in the documentation. I stumbled across this
issue when running a few hundred PHPUnit tests, which resulted in PostgreSQL running out of
available connections after 150's test. I migrated from MySQL recently, which didn't have
that problem. The default number of available connections is 150 for both systems.

The workaround is to use gc_collect_cycles() after unsetting the $pdo. However, the disconnection
should happen immediately after unsetting the variable, not when the GC gets invoked.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68360&edit=1


Thread (5 messages)

« previous php.bugs (#191272) next »