|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51909 mysqli hangs after small request storms.
Submitted: 2010-05-25 22:26 UTC Modified: 2012-02-27 15:08 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ixti at member dot fsf dot org Assigned: mysql (profile)
Status: No Feedback Package: MySQLi related
PHP Version: Irrelevant OS: Debian GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ixti at member dot fsf dot org
New email:
PHP Version: OS:


 [2010-05-25 22:26 UTC] ixti at member dot fsf dot org
The problem is that MySQLi completely hangs after a small storm of requests. I 
have prepared a sample script (attached into bug report) with SQL script used to 
create and populate table (see I also used dummy 
http client written in ruby to storm it with requests. After ~ 130 requests 
proceded one after another MySQLi completely hangs out and stops working until 
Apache2 is restarted. I was tested same storming with pdo_mysql and it was 
working like a charm (more than 1024 continiously repeated requests).

This bug was found upon discussing strange problem in zend Framework mailing 
list. Please refer to discussion for more details: http://zend-framework-

Test script:

$host = 'localhost';
$user = 'user';
$pass = 'pass';
$name = 'test';

header('Content-Type: text/plain');

$mysqli = mysqli_connect($host, $user, $pass, $name);
if ($result = $mysqli->query('SELECT * FROM `my_table`')) {
    while ($obj = $result->fetch_object()) {
        echo $obj->id . ' - ' . $obj->title . PHP_EOL;



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-25 22:46 UTC] ixti at member dot fsf dot org
Shortened URL of discussion thread:
 [2010-05-25 23:51 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: mysql
 [2010-05-25 23:51 UTC]
Please try using this snapshot:
For Windows:

 [2010-05-26 00:54 UTC] ixti at member dot fsf dot org

I have tested it against latest snapshot and it wokred fine.
Here's my configuration:

PHP Version 5.3.3-dev
System: Linux msi-s300 2.6.30-2-686 #1 SMP Fri Dec 4 00:53:20 UTC 2009 i686
Build Date: May 26 2010 00:21:01

MysqlI Support: enabled
Client API library version: 5.1.46

PS I have tested against latest snapshot using PHP as CGI module (while
error was met on 5.3.2 used as Apache 2.0 Handler)

PPS On latest snapshot version mysqli_free_result($result); from test
script started producing a warning:
mysqli_result::close() ... Couldn't fetch mysqli_result
in /var/www/mysqli.php on line 16
 [2010-05-26 00:55 UTC] ixti at member dot fsf dot org
-Status: Feedback +Status: Open
 [2010-05-26 00:55 UTC] ixti at member dot fsf dot org
 [2010-05-26 09:33 UTC] ixti at member dot fsf dot org
Please let me know if you want more information from me. I'm running Debian 
GNU/Linux "testing" with some "sid" mixins :)) But the bug (as you can see in the 
discussion) was first reproduced on FreeBSD :))
 [2010-05-26 14:47 UTC]
-Status: Open +Status: Feedback
 [2010-05-26 14:47 UTC]
What do you mean by hanging? You have Apache workers that don't return and still process some data? Is the CPU usage high?
 [2010-05-26 15:02 UTC] ixti at member dot fsf dot org
-Status: Feedback +Status: Open
 [2010-05-26 15:02 UTC] ixti at member dot fsf dot org
Normally CPU usage is low. It raises up upon rapid continiously requests.
By "hanging" I mean that after some amount of requests with stormer provided in 
discussion it becomes completely impossible to connect to MySQL (at least wth 
MySQLi) so any attempt to connect to MySQL with MySQLi adapter fails. Here's 
example that I was met:

After I have stormed mysqli.php test script with 130 requests it started to tell 
that it can't connect to database. BUT. Even phpMyAdmin started tell me the 
same. While I was able to connect via CLI mysql tool. After all rebooting 
apache2 helps.

If you need I can try to gather more additional information on my current PHP 
(with latest snapshot of PHP there is no such problem at all)
 [2010-05-26 15:10 UTC] ixti at member dot fsf dot org
I can prepare a screencast with showing process of stroming and some statisctics 
information (e.g. top). Alternatively you can test script provided in bug report 
with simple request stormer - I can prepare such in PHP if you want. Basically 
it can be with pecl_http:

$url = 'http://localhost/mysqli.php';
$r   = new HttpRequest($url, HttpRequest::METH_GET);
for ($i = 0; $i < 256; $i++) {
 [2010-08-18 17:21 UTC]
-Status: Open +Status: Feedback
 [2010-08-18 17:21 UTC]
Please try the latest snapshot from
 [2012-02-27 15:08 UTC]
-Status: Feedback +Status: No Feedback
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 17:01:30 2024 UTC