Bug #8519 'wait_timeout' as returned by 'show variables' is not right
Submitted: 15 Feb 2005 15:49 Modified: 15 Feb 2005 16:20
Reporter: Johannes Ullrich Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.9 OS:Linux (Linux (x86_64, Suse 9.1))
Assigned to: CPU Architecture:Any

[15 Feb 2005 15:49] Johannes Ullrich
Description:
If I set 'wait_timeout', either via 'set global' or in my.cnf, it still returns 28800 regardless of the value I set. The actual new timeout does seem to work, but it is just not displayed right.

How to repeat:
in my.cnf add:
set-variable = wait_timeout=6000

restart server

mysql> show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |

now, 'set global wait_timeout=6000;' , disconnect and reconnect, and you will still see 28800.

I used this little perl script to test the actual timeout:
#!/usr/bin/perl

use DBI;
$dbh=DBI->connect("DBI:mysql:db;host=somehost","username","password", { PrintError =>1, RaiseError=>1 } ) || die ("can't connect\n");
$sth=$dbh->prepare("select now()");
$sth->execute();
($start)=$sth->fetchrow_array();
$sth->execute;
($now)=$sth->fetchrow_array();
print "$start $now\n";
sleep 70;
$sth->execute;
($now)=$sth->fetchrow_array();
print "$start $now\n";

if I set the time in the sleep line just below the wait_timeout I set (not the timeout shown by 'show variable'), it will work. I get disconnected if I set it higher (as I should)

Suggested fix:
fix the value displayed by 'show variables'?
[15 Feb 2005 15:55] Mikael Fridh
Not a bug.
Since you're using an interactive client (mysql client identifies itself as that) the timeout used is interactive_timeout.

Change your interactive_timeout and try reconnecting.
[15 Feb 2005 16:20] MySQL Verification Team
Hi,

as Mikael already said, for interactive clients interactive_timeout variable is used.

You can check your changes with:

shell> mysqladmin variables