Bug #70583 [NEW]: mysqlnd drive generates: MySQL server has gone away additional to PDOException
| From: | s dot chernomorets at gmail dot com | Date: | Fri, 25 Sep 2015 14:55:25 +0000 |
| Subject: | Bug #70583 [NEW]: mysqlnd drive generates: MySQL server has gone away additional to PDOException | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196244@lists.php.net to get a copy of this message | ||
From: s dot chernomorets at gmail dot com
Operating system: linux
PHP version: 5.6.13
Package: PDO MySQL
Bug Type: Bug
Bug description:mysqlnd drive generates: MySQL server has gone away additional to PDOException
Description:
------------
In php 5.3 pdo-driver does not generate warnings for error "2006 MySQL
server has gone away", but php 5.6.13 does even when PDO::ATTR_ERRMODE
setted to PDO::ERRMODE_EXCEPTION
Test script:
---------------
# cat <<EOF >t.php
<?php
set_error_handler(function($e, $m) {
echo "set_error_handler: $m; " ; var_dump($e);
}, E_ALL & ~E_STRICT);
$pdo = new PDO(
'mysql:host=localhost;port=3306',
'user',
'password'
);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$s = $pdo->query('select CONNECTION_ID()');
echo "Connection id: ".$s->fetchColumn()."\n";
try {
$pdo->query('select sleep(100)');
}catch(Exception $e) {
echo "Exception: ".$e->getmessage();
//var_dump($e);
}
EOF
# php t.php &
Connection id: 610
# mysql -h localhost -e 'kill 610'
# We kill mysql thread with id "610" from string "Connection id: 610"
Expected result:
----------------
Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone
away
Actual result:
--------------
set_error_handler: PDO::query(): MySQL server has gone away; int(2)
set_error_handler: PDO::query(): Error reading result set's header;
int(2)
Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone
away
--
Edit bug report at https://bugs.php.net/bug.php?id=70583&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70583&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70583&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70583&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70583&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70583&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70583&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70583&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70583&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70583&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70583&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70583&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70583&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70583&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70583&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70583&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70583&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70583&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70583&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70583&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70583&r=mysqlcfg