You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2000/12/14 01:06:00 UTC

is morning bug still relevant?

I think that this item from the guide is not relevant anymore. Can I
kill it? 

=head3 The Morning Bug

Relational database server keeps a connection to the client open for a
limited period of time. Many developers were bitten by so called
B<Morning bug>, when every morning the first users to use the site
received a C<No Data Returned> message, but after that everything
worked fine. The error is caused by C<Apache::DBI> returning a handle
of the invalid connection (the server closed it because of a timeout),
and the script was dying on that error. The infamous C<ping()> method
was introduced to solve this problem, but still people were being
bitten by this problem. Another solution was found - to increase the
timeout parameter when starting the SQL server. Currently I startup
C<MySQL> server with a script C<safe_mysql>, so I have modified it to
use this option:

  nohup $ledir/mysqld [snipped other options] -O wait_timeout=172800


(172800 seconds is equal to 48 hours. This change solves the problem.)

Note that as from version C<0.82>, C<Apache::DBI> implements ping()
inside the C<eval> block.  This means that if the handle has timed out
it should be reconnected automatically, and avoid the morning bug.





_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  



Re: is morning bug still relevant?

Posted by Jie Gao <J....@isu.usyd.edu.au>.
On Thu, 14 Dec 2000, Tim Bunce wrote:

> On Thu, Dec 14, 2000 at 11:47:58AM +1100, Jie Gao wrote:
> > On Thu, 14 Dec 2000, Stas Bekman wrote:
> > 
> > > I think that this item from the guide is not relevant anymore. Can I
> > > kill it? 
> > > 
> > > =head3 The Morning Bug
> > > 
> > > Relational database server keeps a connection to the client open for a
> > > limited period of time. Many developers were bitten by so called
> > > B<Morning bug>, when every morning the first users to use the site
> > > received a C<No Data Returned> message, but after that everything
> > > worked fine. The error is caused by C<Apache::DBI> returning a handle
> > > of the invalid connection (the server closed it because of a timeout),
> > > and the script was dying on that error. The infamous C<ping()> method
> 
> Why is/was ping() infamous?
> 
> > > was introduced to solve this problem, but still people were being
> > > bitten by this problem. Another solution was found - to increase the
> > > timeout parameter when starting the SQL server. Currently I startup
> > > C<MySQL> server with a script C<safe_mysql>, so I have modified it to
> > > use this option:
> > > 
> > >   nohup $ledir/mysqld [snipped other options] -O wait_timeout=172800
> > > 
> > > (172800 seconds is equal to 48 hours. This change solves the problem.)
> > > 
> > > Note that as from version C<0.82>, C<Apache::DBI> implements ping()
> > > inside the C<eval> block.  This means that if the handle has timed out
> > > it should be reconnected automatically, and avoid the morning bug.
> > 
> > Problem is it is not only relevant, but ping doesn't work in all cases.
> > I have to cron-kill/start my servers in the morning.
> 
> With what database driver?
> 
> Some drivers don't support ping others might be buggy. It's not helpful
> to say "ping doesn't work in all cases" without qualifiying why and/or
> which drivers that applies to.

OK, fair enough. It's DBD::Sybase. I have posted the problem to dbi-users
and nobody had a solution to it.

Regards,


Jie


Re: is morning bug still relevant?

Posted by Stas Bekman <st...@stason.org>.
On Thu, 14 Dec 2000, Tim Bunce wrote:

> On Thu, Dec 14, 2000 at 11:47:58AM +1100, Jie Gao wrote:
> > On Thu, 14 Dec 2000, Stas Bekman wrote:
> > 
> > > I think that this item from the guide is not relevant anymore. Can I
> > > kill it? 
> > > 
> > > =head3 The Morning Bug
> > > 
> > > Relational database server keeps a connection to the client open for a
> > > limited period of time. Many developers were bitten by so called
> > > B<Morning bug>, when every morning the first users to use the site
> > > received a C<No Data Returned> message, but after that everything
> > > worked fine. The error is caused by C<Apache::DBI> returning a handle
> > > of the invalid connection (the server closed it because of a timeout),
> > > and the script was dying on that error. The infamous C<ping()> method
> 
> Why is/was ping() infamous?

Something becomes infamous when it solves a big problem :) 

> > > was introduced to solve this problem, but still people were being
> > > bitten by this problem. Another solution was found - to increase the
> > > timeout parameter when starting the SQL server. Currently I startup
> > > C<MySQL> server with a script C<safe_mysql>, so I have modified it to
> > > use this option:
> > > 
> > >   nohup $ledir/mysqld [snipped other options] -O wait_timeout=172800
> > > 
> > > (172800 seconds is equal to 48 hours. This change solves the problem.)
> > > 
> > > Note that as from version C<0.82>, C<Apache::DBI> implements ping()
> > > inside the C<eval> block.  This means that if the handle has timed out
> > > it should be reconnected automatically, and avoid the morning bug.
> > 
> > Problem is it is not only relevant, but ping doesn't work in all cases.
> > I have to cron-kill/start my servers in the morning.

Yeah, it doesn't help if you don't mention what DBD you are talking about.
Jie, can you override the timeout setting for your server as in example
above?


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  



Re: is morning bug still relevant?

Posted by Tim Bunce <Ti...@ig.co.uk>.
On Thu, Dec 14, 2000 at 11:47:58AM +1100, Jie Gao wrote:
> On Thu, 14 Dec 2000, Stas Bekman wrote:
> 
> > I think that this item from the guide is not relevant anymore. Can I
> > kill it? 
> > 
> > =head3 The Morning Bug
> > 
> > Relational database server keeps a connection to the client open for a
> > limited period of time. Many developers were bitten by so called
> > B<Morning bug>, when every morning the first users to use the site
> > received a C<No Data Returned> message, but after that everything
> > worked fine. The error is caused by C<Apache::DBI> returning a handle
> > of the invalid connection (the server closed it because of a timeout),
> > and the script was dying on that error. The infamous C<ping()> method

Why is/was ping() infamous?

> > was introduced to solve this problem, but still people were being
> > bitten by this problem. Another solution was found - to increase the
> > timeout parameter when starting the SQL server. Currently I startup
> > C<MySQL> server with a script C<safe_mysql>, so I have modified it to
> > use this option:
> > 
> >   nohup $ledir/mysqld [snipped other options] -O wait_timeout=172800
> > 
> > (172800 seconds is equal to 48 hours. This change solves the problem.)
> > 
> > Note that as from version C<0.82>, C<Apache::DBI> implements ping()
> > inside the C<eval> block.  This means that if the handle has timed out
> > it should be reconnected automatically, and avoid the morning bug.
> 
> Problem is it is not only relevant, but ping doesn't work in all cases.
> I have to cron-kill/start my servers in the morning.

With what database driver?

Some drivers don't support ping others might be buggy. It's not helpful
to say "ping doesn't work in all cases" without qualifiying why and/or
which drivers that applies to.

Tim.

Re: is morning bug still relevant?

Posted by Jie Gao <J....@isu.usyd.edu.au>.
On Thu, 14 Dec 2000, Stas Bekman wrote:

> I think that this item from the guide is not relevant anymore. Can I
> kill it? 
> 
> =head3 The Morning Bug
> 
> Relational database server keeps a connection to the client open for a
> limited period of time. Many developers were bitten by so called
> B<Morning bug>, when every morning the first users to use the site
> received a C<No Data Returned> message, but after that everything
> worked fine. The error is caused by C<Apache::DBI> returning a handle
> of the invalid connection (the server closed it because of a timeout),
> and the script was dying on that error. The infamous C<ping()> method
> was introduced to solve this problem, but still people were being
> bitten by this problem. Another solution was found - to increase the
> timeout parameter when starting the SQL server. Currently I startup
> C<MySQL> server with a script C<safe_mysql>, so I have modified it to
> use this option:
> 
>   nohup $ledir/mysqld [snipped other options] -O wait_timeout=172800
> 
> 
> (172800 seconds is equal to 48 hours. This change solves the problem.)
> 
> Note that as from version C<0.82>, C<Apache::DBI> implements ping()
> inside the C<eval> block.  This means that if the handle has timed out
> it should be reconnected automatically, and avoid the morning bug.

Problem is it is not only relevant, but ping doesn't work in all cases.
I have to cron-kill/start my servers in the morning.

Cheers,


Jie