Bug #8731 MySQL does not respect set timeouts on Mac OS X
Submitted: 23 Feb 2005 14:30 Modified: 19 Oct 2005 14:38
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3, 4.1.10a, 4.0.23 OS:Mac OS X (mac os x, freebsd)
Assigned to: Jim Winstead

[23 Feb 2005 14:30] Guilhem Bichot
Description:
Start mysqld on our g5, with --interactive-timeout=3.
Open a 'mysql' command line client, do nothing for more than 3 seconds, then issue a command: your connection is still alive :(
Contrary to what happens on my Linux, where I get as expected:
MASTER> show tables;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    6

This apparently affects other timeouts: --slave-net-timeout too (slave never auto-breaks its connection whereas it should - which explains why rpl_auto_increment failed *only* on Mac OS X on Feb 22nd 2005).

I don't know if related, but mysqld often does not react to SIGTERM on our g5 (it is not always repeatable but quite frequent), while it reacts to mysqladmin shutdown. Maybe timeouts are implemented with alarm() and so SIGALRM?

How to repeat:
see description
[23 Feb 2005 16:14] Sinisa Milivojevic
Guilhem, 

mon ami,

You do not know what interactive timeout is for !!

For what you are testing, try wait timeout !!
[26 Feb 2005 14:12] Guilhem Bichot
Sinisa, the manual says:
@item interactive_timeout
The number of seconds the server waits for activity on an interactive
connection before closing it.  An interactive client is defined as a
client that uses the @code{CLIENT_INTERACTIVE} option to
@code{mysql_real_connect()}.
@item wait_timeout
The number of seconds the server waits for activity on a non-interactive
connection before closing it.

Our command-line client 'mysql' uses CLIENT_INTERACTIVE (unless --batch).  So interactive_timeout is what applies to it. And indeed, when I set interactive_timeout to 3 seconds on a Linux mysqld, and do nothing in my 'mysql' command-line client, I get disconnected after 3 seconds. But on our g5 machine, mysqld and 'mysql' on g5, I don't get disconnected and this is the bug.
There is a bug in our timeout code on Mac OS X (both interactive_timeout and slave_net_timeout are affected).
[26 Feb 2005 18:45] Sinisa Milivojevic
Guilhem mon ami,

Can you please look at both your global my.cnf's and local .my.cnf's on both machines and see if you have any differences, especially under the following option headers: 

[client]
[mysql]
[27 Feb 2005 16:21] Guilhem Bichot
Hello Sinisa,
No /etc/my.cnf on both machines. And none in the datadir.
Believe me, there *is* a bug with timeouts on our Mac OS X MySQL. Interactive_timeout is not observed, neither is slave_net_timeout.
[28 Mar 2005 17:08] Jorge del Conde
Verified using 5.0.3 on a g4
[1 Apr 2005 1:39] Lachlan Mulcahy
This appears to effect any BSD based system, not just Mac OS X. Also, I've experienced this problem with both 4.1.10a and the 4.0 tree.
[9 Apr 2005 0:53] Jim Winstead
i believe this is related to bug #9712 -- dropped connections over a unix socket aren't being picked up on irix and mac os x properly.
[15 Jul 2005 23:29] Jim Winstead
Waiting for feedback from other developers and/or Apple on problems introduced by fix for this bug.
[13 Sep 2005 18:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/29763
[20 Sep 2005 19:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30121
[6 Oct 2005 21:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30785
[11 Oct 2005 16:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30925
[13 Oct 2005 15:13] Jim Winstead
Fixed in 4.1.16 and 5.0.15.
[19 Oct 2005 14:38] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented fixes in 4.1.16 and 5.0.15 changelogs. Closed.
[22 Jun 2006 15:18] Martin Tsachev
On FreeBSD with 5.0.22 works only if I compile MySQL w/o linux threads. With linux threads on it still ignores both wait_timeout and interactive_timeout.
[22 Jun 2006 19:06] Konstantin Osipov
Please don't comment on a closed bug report - your comment may get lost and not reach a developer. Do you have a reproducible test case for the problem? Is so, could you please report it in a separate bug report? This way it will go through our verification process and will be addressed.