Bug #103412 ER_CLIENT_INTERACTION_TIMEOUT sends wrong Compressed Packet Number
Submitted: 21 Apr 2021 19:36 Modified: 27 Jul 2021 15:20
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.24 OS:Linux (mysql:8.0.24 Docker image)
Assigned to: CPU Architecture:Any

[21 Apr 2021 19:36] Bradley Grainger
Description:
MySQL Server 8.0.24 sends a new error packet (with code ER_CLIENT_INTERACTION_TIMEOUT) when the wait_timeout expires. If protocol compression is used, the sequence number in the compressed packet header is non-zero, but a sequence number of zero would be expected.

In uncompressed.pcap, the client connects without protocol compression. At wait_timeout=3 seconds, the server sends a ER_CLIENT_INTERACTION_TIMEOUT packet (packet #20). This has a sequence number of 0.

In compressed.pcap, the client connects with protocol compression. At wait_timeout=3 seconds, the server sends a ER_CLIENT_INTERACTION_TIMEOUT packet (packet #20). This has a sequence number of 2, which is unexpected. It should be 0, just like the uncompressed scenario. (The compressed payload inside does have a sequence number of 0; the outer sequence number should match.)

Clients that verify that sequence numbers match what they expect may be broken by this change.

How to repeat:
Connect to MySQL 8.0.24 using protocol compression. Set wait_timeout to a short value (e.g., 3 seconds). Open a connection and then sleep for longer than wait_timeout. Observe that the error packet sent from the server has the wrong sequence number.

Suggested fix:
The compressed packet sequence number should be 0 because a new conversation is being started.
[21 Apr 2021 19:36] Bradley Grainger
Uncompressed protocol packet capture

Attachment: uncompressed.pcap (application/octet-stream, text), 2.82 KiB.

[21 Apr 2021 19:36] Bradley Grainger
Compressed protocol packet capture

Attachment: compressed.pcap (application/octet-stream, text), 2.79 KiB.

[30 Apr 2021 6:42] MySQL Verification Team
Hello Bradley,

Thank you for the report and feedback!

regards,
Umesh
[27 Jul 2021 15:20] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.27:

The error packet that MySQL Server sends to a client program when the wait timeout expires (ER_CLIENT_INTERACTION_TIMEOUT) used an incorrect sequence number of 2 instead of 0 in the packet header when protocol compression was used.