Bug #115435 Interactive interface new connection session wait_timeout value error
Submitted: 26 Jun 2024 10:13 Modified: 27 Jun 2024 10:33
Reporter: li liu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.44 OS:CentOS
Assigned to: CPU Architecture:x86

[26 Jun 2024 10:13] li liu
Description:
After modifying the global wait_timeout, create a new connection in the interactive interface. The value of session wait_timeout is inconsistent with that of global wait_timeout, and is consistent with the value of global interactive_timeout

How to repeat:
mysql> select @@global.interactive_timeout;
+------------------------------+
| @@global.interactive_timeout |
+------------------------------+
|                          800 |
+------------------------------+
1 row in set (0.00 sec)

mysql> select @@global.wait_timeout;
+-----------------------+
| @@global.wait_timeout |
+-----------------------+
|                  1000 |
+-----------------------+
1 row in set (0.00 sec)

mysql> exit
Bye

# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.7.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@session.wait_timeout;
+------------------------+
| @@session.wait_timeout |
+------------------------+
|                    800 |
+------------------------+
1 row in set (0.00 sec)

mysql> select @@global.interactive_timeout;
+------------------------------+
| @@global.interactive_timeout |
+------------------------------+
|                          800 |
+------------------------------+
1 row in set (0.00 sec)

mysql> select @@global.wait_timeout;
+-----------------------+
| @@global.wait_timeout |
+-----------------------+
|                  1000 |
+-----------------------+
1 row in set (0.00 sec)

Suggested fix:
The value of session wait_timeout when creating a new connection in interactivity should be consistent with global wait_timeout
Create a new connection in a non interactive environment where the value of session interactive_timeout is consistent with that of global interactive_timeout
[26 Jun 2024 10:24] MySQL Verification Team
HI Mr. liu,

Thank you for your bug report.

However, there are two issues with your report.

First one is that version 5.7 is no longer maintained. Current supported versions are 8.0 and 8.4.

Second one is that wait and interactive timeout are two distinct timeouts in MySQL for the last 20 (twenty) years and one or the other is applied, depending on whether it is an interactive or batch program.

This behaviour will not change.

Unsupported.
[27 Jun 2024 8:14] Tsubasa Tanaka
FYI.

This behavior is same on 8.0 and 8.4, not only 5.7.
But it has been already written in Document.

> On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also interactive_timeout.

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout
[27 Jun 2024 10:33] MySQL Verification Team
Thank you, Mr. Tanaka, for your contribution.

This is truly not a bug.