Bug #35377 Interactive_timeout is not disconnecting client after time specified by user
Submitted: 18 Mar 2008 7:42 Modified: 22 Mar 2008 9:19
Reporter: Salman Rawala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.1.22 OS:Any (MS Windows, Linux)
Assigned to: CPU Architecture:Any
Tags: interactive_timeout

[18 Mar 2008 7:42] Salman Rawala
Description:
Interactive_timeout is not disconnecting client on waiting for any data through that client after the time specified by user in this variable.

How to repeat:
SET @@global.interactive_timeout = 1;

# Creating interactive client
connect (test_con1, localhost, root,,,,CLIENT_INTERACTIVE);
connection test_con1;

INSERT into t1(name) values('Record_1');

# Setting session value of interactive_timeout
SET @@session.interactive_timeout = 1;

# Using sleep to check timeout
--sleep 5

INSERT into t1(name) values('Record_2');
SELECT * from t1;

--echo Bug: Error should appear here because interactive_timeout value is 1 and connection remains idle for 5 secs

Suggested fix:
Server should disconnect connection after interactive timeout seconds
[18 Mar 2008 22:02] Sveta Smirnova
Thank you for the report.

Verified as described, but with PHP test. MySQL command line client works fine.

Test:

php -r 'mysql_connect("127.0.0.1:3350", "root"); mysql_query("SET @@session.interactive_timeout = 1;"); sleep(20);  $res = mysql_query("select  @@global.interactive_timeout,  @@session.interactive_timeout;"); var_dump(mysql_error(), mysql_fetch_row($res));'
[22 Mar 2008 9:19] Sveta Smirnova
I am sorry: my fault.

Client should use CLIENT_INTERACTIVE option to mysql_real_connect(). MySQL test suite uses C API to connect to server, but not set CLIENT_INTERACTIVE flag.