Bug #68360 [Opn->Fbk]: PDO PgSQL doesn't disconnect as expected
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: Open
+Status: Feedback
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:
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?
Previous Comments:
------------------------------------------------------------------------
[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)