Bug #26781 "MySQL server has gone away" followed by correct results from query
Submitted: 2 Mar 2007 3:44 Modified: 13 Mar 2007 12:54
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.27-standard-log OS:Linux (Red Hat Enterprise Linux)
Assigned to: CPU Architecture:Any

[2 Mar 2007 3:44] [ name withheld ]
Description:
At times, MySQL will respond to most queries with an error message followed immediately by the (correct) results of the query.  This apparently occurs for most or almost all queries executed on one particular database, my largest, a DB for the vBulletin application.  They seem to occur both from the command line and from normal usage through PHP.

The site is www.twcenter.net.  Example sessions will be attached, with some potentially sensitive information removed.  I have root access to the server and can execute whatever commands are appropriate.

How to repeat:
Repeatable on my server sometimes.  As I'm writing this, I can repeat it by executing almost any query on the totalwar_vb database, even trivial ones that return zero or one row and return in 0.00 seconds.  However, in the normal course of operations this doesn't occur.  I have not kept statistics on how often the database gets into this state, but I suppose it may be once a month or so.

I can probably fix it by restarting, but since it doesn't seem to noticeably affect the functioning of the board for non-administrators (who see an error message on many pages), I figure it's best to try to fix it.
[2 Mar 2007 3:53] [ name withheld ]
Log of a session from the shell where the error occurs repeatedly

Attachment: sqlsession.txt (text/plain), 13.34 KiB.

[2 Mar 2007 3:55] [ name withheld ]
Note that immediately after the session I just posted, in which the error is somewhat inconsistently exhibited, PuTTY crashed (presumably unrelated), and the error appears to have stopped for now.  If anyone has any advice for what I should try when it occurs again, however, please share.
[2 Mar 2007 6:04] Valeriy Kravchuk
Thank you for a problem report. Please, send the results of:

SHOW GLOBAL STATUS;
SHOW VARIABLES LIKE '%timeout%';
[2 Mar 2007 22:11] [ name withheld ]
The requested information (note that the problem is not currently occurring)

Attachment: sqlsession.txt (text/plain), 12.08 KiB.

[13 Mar 2007 12:54] Valeriy Kravchuk
You have

| interactive_timeout      | 15    |
| wait_timeout             | 15    |

in SHOW VARIABLES. So, each 15 seconds your connection will be closed by server, and for your client server has gone... Read http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html for the details. 

This is not a bug, if you have 15 or so intervals between sending of queries.