Re: MySQL server has gone away?

[prev] [thread] [next] [Date index for 2005/04/10]

From: Bas Schulte
Subject: Re: MySQL server has gone away?
Date: 09:59 on 10 Apr 2005
Hi Harm,

On zondag, apr 10, 2005, at 10:53 Europe/Amsterdam, harm wrote:

>> DBD::mysql::st execute failed: MySQL server has gone away at
>> /opt/ttgp/dev/webapp/ttgp/smsclient/perl/sms line 111.
>>
>> This happens after several hours of idle time in the webserver.
>
> looks like a connection timeout. Try:
> $dbh->{'mysql_auto_reconnect'} = 1;
> From the DBD::MySQL manpage:
> mysql_auto_reconnect
> 	This attribute determines whether DBD::mysql will automatically
> 	reconnect to mysql if the connection be lost.
>
> Or change the connection timeout in the mysql server.

I'll try that. Maybe the timeout settings are different for this MySQL 
instance, don't know.

But it's still werid, basically the same setup has been running just 
fine for many years.


>> I'm doing the general thing: use Apache::DBI (); in my startup.pl, it
>> just works, until now.
>>
>> Three things are different:
>>
>> - in a BEGIN block, I connect to the database, retrieve data, and then
>> generate perl code on the fly;
>
> Under mod_perl mysql_auto_reconnect should default to 'on', but since 
> you
> connect in a BEGIN block DBI might not yet know it runs under mod_perl.

I suspect this might have something to do with the problem, as it's the 
biggest change in the code; doing stuff during BEGIN.

I do get a message from Apache::DBI during startup, on stderr:

10039 Apache::DBI             skipping connection during server 
startup, read the docu !!

I'll investigate further, thanks for the info.

Regards,

Bas.

MySQL server has gone away?
Bas Schulte 08:25 on 10 Apr 2005

Re: MySQL server has gone away?
harm 08:53 on 10 Apr 2005

Re: MySQL server has gone away?
Bas Schulte 09:59 on 10 Apr 2005

Re: MySQL server has gone away?
Bas Schulte 23:18 on 10 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52