Bug #68360 [Fbk->NoF]: PDO PgSQL doesn't disconnect as expected
Edit report at https://bugs.php.net/bug.php?id=68360&edit=1
ID: 68360
Updated by: php-bugs@lists.php.net
Reported by: ianbytchek at gmail dot com
Summary: PDO PgSQL doesn't disconnect as expected
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: PDO PgSQL
Operating System: OS X 10.10
PHP Version: 5.6.2
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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)