php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49287 MySQLi client compression broken (mysqlnd)
Submitted: 2009-08-18 13:57 UTC Modified: 2009-08-28 10:29 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: shooreek at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.3.0 OS: WinXP SP3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shooreek at gmail dot com
New email:
PHP Version: OS:

 

 [2009-08-18 13:57 UTC] shooreek at gmail dot com
Description:
------------
It seems like mysqli do not understand compression protocol. When you are using flag MYSQLI_CLIENT_COMPRESS in mysqli_real_connect - it connects, but can't properly handle server (compressed?) answer.

MySQL server 5.0.67-community-nt-log with compression enabled:

mysql> show variables like '%have_comp%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_compress | YES   |
+---------------+-------+
1 row in set (0.00 sec)

I can connect to MySQL server using command line client with flag '-C' (use compression):

C:\Documents and Settings\U>mysql -C
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.0.67-community-nt-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show status like '%compr%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Compression   | ON    |
+---------------+-------+
1 row in set (0.00 sec)

mysql>


I think that something is wrong with mysqli and flag MYSQLI_CLIENT_COMPRESS

Reproduce code:
---------------
$mysqli = mysqli_init();
if (!$mysqli) {
    die('mysqli_init failed');
}

if (!$mysqli->real_connect('localhost', '', '', NULL, NULL, NULL, MYSQLI_CLIENT_COMPRESS)) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}
$mysqli->query("show status like '%compre%'");
$mysqli->close();


Expected result:
----------------
Normal query execution without any errors.

Actual result:
--------------
PHP
Some times it crushes. Sometimes it do not.
Error log:

PHP Warning:  mysqli::query(): MySQL server has gone away in C:\Documents and Settings\U\Desktop\compress_test.php on line 42
PHP Warning:  mysqli::query(): Error reading result set's header in C:\Documents and Settings\U\Desktop\compress_test.php on line 42

MySQL
Error log:

090818 17:36:04 [Warning] Aborted connection 8 to db: 'unconnected' user: 'U' host: 'localhost' (Got a packet bigger than 'max_allowed_packet' bytes)

someimes:

090818 17:31:13 [Warning] Aborted connection 61 to db: 'unconnected' user: 'U' host: 'localhost' (Got an error reading communication packets)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-18 15:14 UTC] jani@php.net
This is most likely mysqlnd issue since PHP 5.3 binaries for win32 use mysqlnd.
 [2009-08-26 09:09 UTC] uw@php.net
Duplicate of http://bugs.php.net/bug.php?id=47017 . Feature request.
 [2009-08-28 10:29 UTC] shooreek at gmail dot com
Description:
------------
It seems like mysqli do not understand compression protocol. When you
are using flag MYSQLI_CLIENT_COMPRESS in mysqli_real_connect - it
connects, but can't properly handle server (compressed?) answer.

MySQL server 5.0.67-community-nt-log with compression enabled:

mysql> show variables like '%have_comp%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_compress | YES   |
+---------------+-------+
1 row in set (0.00 sec)

I can connect to MySQL server using command line client with flag '-C'
(use compression):

C:\Documents and Settings\U>mysql -C
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.0.67-community-nt-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show status like '%compr%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Compression   | ON    |
+---------------+-------+
1 row in set (0.00 sec)

mysql>

I think that something is wrong with mysqli and flag
MYSQLI_CLIENT_COMPRESS

Reproduce code:
---------------
$mysqli = mysqli_init();
if (!$mysqli) {
    die('mysqli_init failed');
}

if (!$mysqli->real_connect('localhost', '', '', NULL, NULL, NULL,
MYSQLI_CLIENT_COMPRESS)) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}
$mysqli->query("show status like '%compre%'");
$mysqli->close();

Expected result:
----------------
Normal query execution without any errors.

Actual result:
--------------
PHP
Some times it crushes. Sometimes it do not.
Error log:

PHP Warning:  mysqli::query(): MySQL server has gone away in
C:\Documents and Settings\U\Desktop\compress_test.php on line 42
PHP Warning:  mysqli::query(): Error reading result set's header in
C:\Documents and Settings\U\Desktop\compress_test.php on line 42

MySQL
Error log:

090818 17:36:04 [Warning] Aborted connection 8 to db: 'unconnected'
user: 'U' host: 'localhost' (Got a packet bigger than
'max_allowed_packet' bytes)

sometimes:

090818 17:31:13 [Warning] Aborted connection 61 to db: 'unconnected'
user: 'U' host: 'localhost' (Got an error reading communication
packets)

===============

Correct documentation, please, if it is a feature request.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 05:01:27 2024 UTC