|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64763 unbuffered queries connection problems are not handled by mysqlnd
Submitted: 2013-05-02 17:31 UTC Modified: 2021-08-23 14:31 UTC
Avg. Score:4.5 ± 0.8
Reproduced:17 of 18 (94.4%)
Same Version:1 (5.9%)
Same OS:2 (11.8%)
From: ihanick at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: MySQL related
PHP Version: master-Git-2013-05-02 (snap) OS: CentOS release 6.4
Private report: No CVE-ID: None
 [2013-05-02 17:31 UTC] ihanick at gmail dot com
Partially finished unbuffered query for mysql doesn't return any errors.
The problem persists for all current versions of mysqlnd but everything find with 
old libmysqlclient code for all mysql extensions: mysql, mysqli, pdo-mysql.

If I have 100k rows in query and connection dropped at 50k point, there is no 
simple way to see this error in application and handle the problem.

Test script:
1) create a big table to have several seconds for select * from table execution time
2) run php script
3) kill connection from php to mysql or kill mysqld

$link = mysql_connect('localhost', 'root', '');
mysql_select_db('test') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM x;';
$result = mysql_unbuffered_query($query) or die('Query failed: ' . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo mysql_error($link) . PHP_EOL;

Expected result:
Warning about connection problems and
mysql_error should return Query failed: MySQL server has gone away

Everything works correctly for old (non-mysqlnd) extension.

Actual result:
getting warning:
Warning: Empty row packet body in /root/php5-trunk/test.php on line 10

But empty result for mysql_error($link)


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-03 15:59 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2017-10-24 08:03 UTC]
-Status: Assigned +Status: Open -Assigned To: mysql +Assigned To:
 [2021-08-23 14:31 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-08-23 14:31 UTC]
This appears to be a duplicate of bug #66370, and is supposed to
be fixed as of PHP 7.4.13.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 20:01:28 2024 UTC