Edit report at https://bugs.php.net/bug.php?id=64549&edit=1
ID: 64549
Comment by: patryk dot kozlowski at toxic-software dot pl
Reported by: rgagnon24 at gmail dot com
Summary: mysqlnd persistent connection handling out of
control
Status: Open
Type: Bug
Package: MySQL related
Operating System: CentOS 5.9
PHP Version: 5.3.23
Block user comment: N
Private report: N
New Comment:
PHP Warning: PDO::__construct(): MySQL server has gone away in <filepath> on line
<line_number> - this error still occurs randomly on lastes versions of php-5.5 and php-5.6
Previous Comments:
------------------------------------------------------------------------
[2013-06-14 05:13:59] rgagnon24 at gmail dot com
Related To: Bug #64993
------------------------------------------------------------------------
[2013-06-14 05:09:14] rgagnon24 at gmail dot com
The solution may lie in the patch attached to bug 64993 which does not clear a reference or free
memory when a failed SQL happens.
------------------------------------------------------------------------
[2013-06-07 10:00:45] uw@php.net
PDO - that's the thing that does its own pooling, isn't it? Wondering if this is MySQL
specific at all...
------------------------------------------------------------------------
[2013-04-02 16:48:20] rgagnon24 at gmail dot com
Question: Why is there a gtk window git pull request recorded on this bug?
------------------------------------------------------------------------
[2013-04-02 16:47:07] rgagnon24 at gmail dot com
Another thing that is probably related to this...
PDO constructor can emit a warning that it really should not be able to. It just doesn't make
any sense:
PHP Warning: PDO::__construct(): MySQL server has gone away in <filepath> on line
<line_number>
This can happen when PDO::ATTR_PERSISTENT => true is passed during PDO construction, as in:
$dbh = new PDO($dsn_str, $user_name, $password, array(PDO::ATTR_PERSISTENT => true));
A warning like "mysql server has gone away" doesn't make any sense here. What seems
to be happening is that the underlying mysqlnd code is finding a connection in its pool that has
died, and it performs a reconnect for you, but the warning is still emitted on the connection.
You would think if you can't connect, that a PDOException would be raised. No exception is
raised because the connection is in fact returned in a working condition, but the warning is still
emitted to the error system.
The only workaround I could find was to prefix the statement with "@" as in
$dbh = @new PDO($dsn_str, $user_name, $password, array(PDO::ATTR_PERSISTENT => true));
Any REAL connection exception is still raised, but at least the fake warning is suppressed.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64549
--
Edit this bug report at https://bugs.php.net/bug.php?id=64549&edit=1