Bug #27846 mysql server does not honor the default wait_timeout variable
Submitted: 16 Apr 2007 11:16 Modified: 16 May 2007 18:10
Reporter: Dragan Milivojevic Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.22 OS:Linux (RHEL5)
Assigned to: Assigned Account CPU Architecture:Any

[16 Apr 2007 11:16] Dragan Milivojevic
Description:
rpm -q mysql-server
mysql-server-5.0.22-2.1
Packager    : Red Hat, Inc.

show variables shows that wait_timeout is set at 28800. Actually it is somewhere around 10 sec. 

Small test

<?php
	require_once ("db.config.php");
	$link = mysql_connect($db_host, $db_username, $db_password) or die("Could not connect : " . mysql_error() . "\n");
	mysql_select_db($db_name) or die("Could not select database: " . $db_name . "\n");

		$query =  "SHOW tables";
		$result = mysql_query($query);
		sleep(10);
		$result = mysql_query($query);
?>

the second query bugs out with 
PHP Warning:  mysql_query(): Lost connection to MySQL server during query in /root/system_scripts/ping/blog/test.php on line 9

If I set the sleep() to a value under 10 seconds everything is fine.

After the wait_timeout has been set in my.cnf everything works as expected.

I'm having the same issue on my shared hosting, mysql 5.0.18, default my.cnf. 
Same thing, only after 20 seconds.

How to repeat:
<?php
	require_once ("db.config.php");
	$link = mysql_connect($db_host, $db_username, $db_password) or die("Could not connect : " . mysql_error() . "\n");
	mysql_select_db($db_name) or die("Could not select database: " . $db_name . "\n");

		$query =  "SHOW tables";
		$result = mysql_query($query);
		sleep(10);
		$result = mysql_query($query);
?>
[16 Apr 2007 11:24] Sveta Smirnova
Thank you for the report.

But version 5.0.22 is quite old. Please try with new version and if you can repeat issue via PHP script mysql_query("SHOW variables like 'wait_timeout'"); and send us result.
[16 Apr 2007 13:22] MySQL Verification Team
Hi Mr.Milivojevic,

In order to verify bug we need to have a repeatable test case that always reveals the problem on the latest version of the product.

Also, do keep in mind that, depending on the client, INTERACTIVE TIMEOUT will be validated instead of the WAIT TIMEOUT.

Sinisa Milivojevic
[16 Apr 2007 13:56] Dragan Milivojevic
Default value for interactive_timeout is same as for wait_timeout, at least under RHEL 5.
The php code that I sent is repeatable test. 
As for the test on the latest version: I'm sorry I don't have enough spare time to do that now.
Bug report was sent to RedHat also. They will probably test it more extensively.

I'm sorry I can't assist you anymore regarding this issue at this time.
[16 Apr 2007 18:10] Sveta Smirnova
Dragan,

thank you for the feedback. But I haven't received answer to my question.

Please post here output of next PHP script:

<?php
require_once ("db.config.php");
$link = mysql_connect($db_host, $db_username, $db_password) or die("Could not
connect : " . mysql_error() . "\n");

$query =  "SHOW variables like '%timeout%'";
$result = mysql_query($query);
while ($row = mysql_fetch_row($result))
	var_dump($row);
?>
[16 May 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".