Bug #81335 [Opn->Ver]: PHP Warning, Packets out of order after connection timeout
| From: | dharman@php.net | Date: | Fri, 06 Aug 2021 12:43:21 +0000 |
| Subject: | Bug #81335 [Opn->Ver]: PHP Warning, Packets out of order after connection timeout | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235645@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81335&edit=1
ID: 81335
Updated by: dharman@php.net
Reported by: bohuslav at simek dot si
Summary: PHP Warning, Packets out of order after connection
timeout
-Status: Open
+Status: Verified
Type: Bug
Package: PDO MySQL
Operating System: Alpine Linux 3.14
PHP Version: 7.4.22
Block user comment: N
Private report: N
New Comment:
Thanks for reporting. This indeed should be fixed in mysqlnd. Tested on git.master and the mysqlnd
client doesn't notice the connection has dropped when sending a query.
Previous Comments:
------------------------------------------------------------------------
[2021-08-06 10:37:58] bohuslav at simek dot si
Description:
------------
After migration from MySQL 8.0.23 to 8.0.25 a warning "Packets out of order. Expected 1
received 0. Packet size=145" will be shown after MySQL connection timeout. mysqlnd is used a as
connection library.
pdo_mysql
PDO Driver for MySQL => enabled
Client API version => mysqlnd 8.0.8
I don't want to speculate, but this can be caused by changes introduce in Connection Management
by MySQL 8.0.24 (https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html header Connection
Management Notes) as MySQL now provides reason why client has been disconnected.
Test script:
---------------
<?php declare(strict_types=1);
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_PERSISTENT => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET time_zone = "UTC"',
PDO::ATTR_EMULATE_PREPARES => true,
];
$pdo = new PDO(
'mysql:dbname=unit_tests;host=mysql-test;port=3306;charset=utf8mb4',
'root',
'',
$options
);
$pdo->exec('SET SESSION wait_timeout=1');
sleep(3);
$pdo->exec('SELECT 123'); // PHP Warning: Packets out of order. Expected 1 received 0.
Packet size=145
Expected result:
----------------
warning "Packets out of order. Expected 1 received 0. Packet size=145" should not happen.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81335&edit=1