[Nitro] Loosing connection to DB

Lou Vanek vanek at acd.net
Tue Jun 21 17:39:26 EDT 2005


It sounds like the mysql db connection is not being closed after it is used.

MySQL has two variables, 'wait_timeout' and 'interactive_timeout' that 
specify how long a dormant db connection will be
allowed to remain open before it is automatically closed by mysql. Both 
of these variables are usually set to 28800 (i.e. 8 hrs).

Wait_timeout is used by connections that are supposed to be short-lived. 
In my opinion, this should be reset to something more
on the order of 90 instead of 28800.

show variables like '%timeout%'

Interactive_timeout is used by programs like the 'mysql' client program 
that expects to be connected for long periods of time.

I guess the solution is to test the db connection and reconnect if the 
connection has been terminated by mysql.

George Moschovitis wrote:
> Dear devs,
> 
> I have a Webrick server running as a daemon and connecting to a Mysql
> Database. Some times,
> about every 3-4 days I get an error like:
> 
> Mysql server has gone away.
> 
> Has anyone seen any similar behaviour or has any idea what may be causing this?
> 
> thanks in advance for any help
> 
> George.





More information about the Nitro-general mailing list