Eric Ravelo
2006-Oct-10 15:40 UTC
"MySQL server has gone away" with Apache 2.2 + Mongrel cluster
Hi I just setup a server (Apache 2.2, mod_proxy_balancer, mongrel_cluster) with 2 Rails applications according to this excellent Post: http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you Everythings works great, but after a long inactive period (say one night), the first 3 connections allways get an Error 500 Excerpt from production.log: ... Rendering authentication/login Completed in 0.00301 (332 reqs/sec) | Rendering: 0.00279 (92%) | DB: 0.00000(0%) | 200 OK [ http://myapp/authentication/login ] Mysql::Error: MySQL server has gone away: SELECT * FROM sessions WHERE (session_id = ''875b6a6dff4de7e8bb2f7709cf9c31db'') LIMIT 1 ... Note: the mongrel cluster is configured to have 3 mongrel processes. Is this a clue why only the first 3 connections allways get the error ? Thanks for your input. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ed Hickey
2006-Oct-10 15:42 UTC
Re: "MySQL server has gone away" with Apache 2.2 + Mongrel cluster
what version of MySQL are you running? ed On 10/10/06, Eric Ravelo <eravelo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi > > I just setup a server (Apache 2.2, mod_proxy_balancer, mongrel_cluster) > with 2 Rails applications according to this excellent Post: > > http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you > > Everythings works great, but after a long inactive period (say one night), > the first 3 connections allways get an Error 500 > > Excerpt from production.log: > ... > Rendering authentication/login > Completed in 0.00301 (332 reqs/sec) | Rendering: 0.00279 (92%) | DB: > 0.00000 (0%) | 200 OK > [ http://myapp/authentication/login ] > Mysql::Error: MySQL server has gone away: SELECT * FROM sessions WHERE > (session_id = ''875b6a6dff4de7e8bb2f7709cf9c31db'') LIMIT 1 > ... > > Note: the mongrel cluster is configured to have 3 mongrel processes. Is > this a clue why only the first 3 connections allways get the error ? > > Thanks for your input. > > > >-- Ed Hickey Developer Litmus Media 816-533-0409 ehickey-A4HEbNdjHgMmlAP/+Wk3EA@public.gmane.org A Member of Think Partnership, Inc www.ThinkPartnership.com Amex ticker symbol: THK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
eravelo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-10 15:45 UTC
Re: "MySQL server has gone away" with Apache 2.2 + Mongrel cluster
On Debian Sarge: dpkg --list | grep mysql ii libdbd-mysql-p 2.9006-1 A Perl5 database interface to the MySQL data ii libmysqlclient 3.23.56-3 LGPL-licensed client library for MySQL datab ii libmysqlclient 3.23.56-3 LGPL-licensed client development files for M ii libmysqlclient 4.0.24-10sarge mysql database client library ii libmysqlclient 4.1.11a-4sarge mysql database client library ii mysql-client-4 4.1.11a-4sarge mysql database client binaries ii mysql-common-4 4.1.11a-4sarge mysql database common files (e.g. /etc/mysql ii mysql-server-4 4.1.11a-4sarge mysql database server binaries --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
eden li
2006-Oct-10 15:52 UTC
Re: "MySQL server has gone away" with Apache 2.2 + Mongrel cluster
> Everythings works great, but after a long inactive period (say one night), > the first 3 connections allways get an Error 500Did you "gem install mysql" the latest version of the mysql gem? That always seems to clear up my mysql issues. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Daniel Azuma
2006-Oct-10 16:19 UTC
Re: "MySQL server has gone away" with Apache 2.2 + Mongrel c
MySQL times out connections after a period of inactivity. (see http://dev.mysql.com/doc/refman/5.0/en/gone-away.html) I think the period defaults to 8 hours. You can see the same behavior if you open a connection using the "mysql" command-line client, and leave it inactive for a long time. The next query will fail at first (but the client automatically reconnects). Apparently, there are system variables (wait_timeout and interactive_timeout) that you can set to increase the timeout. I''ve never had to do this from Rails, though, so I''m not sure of the procedure. In our case, we have a monitoring script that hits our site and database periodically to make sure it''s all still up, and that has the side effect of keeping the mysql connections alive. Daniel Azuma Zoodango.com Eric Ravelo wrote:> Everythings works great, but after a long inactive period (say one > night), > the first 3 connections allways get an Error 500 > > Excerpt from production.log: > ... > Rendering authentication/login > Completed in 0.00301 (332 reqs/sec) | Rendering: 0.00279 (92%) | DB: > 0.00000(0%) | 200 OK > [ http://myapp/authentication/login ] > Mysql::Error: MySQL server has gone away: SELECT * FROM sessions WHERE > (session_id = ''875b6a6dff4de7e8bb2f7709cf9c31db'') LIMIT 1-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Eric Ravelo
2006-Oct-10 16:26 UTC
Re: "MySQL server has gone away" with Apache 2.2 + Mongrel cluster
I dont know what the latest mysql gem version is. However, gem list --local shows mysql (2.7) On 10/10/06, eden li <eden.li-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > Everythings works great, but after a long inactive period (say one > night), > > the first 3 connections allways get an Error 500 > > Did you "gem install mysql" the latest version of the mysql gem? That > always seems to clear up my mysql issues. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Eric Ravelo
2006-Nov-04 02:35 UTC
[Rails] "MySQL server has gone away" with Apache 2.2 + Mongrel cluster
Hi I just setup a server (Apache 2.2, mod_proxy_balancer, mongrel_cluster) with 2 Rails applications according to this excellent Post: http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you Everythings works great, but after a long inactive period (say one night), the first 3 connections allways get an Error 500 Excerpt from production.log: ... Rendering authentication/login Completed in 0.00301 (332 reqs/sec) | Rendering: 0.00279 (92%) | DB: 0.00000(0%) | 200 OK [http://myapp/authentication/login] Mysql::Error: MySQL server has gone away: SELECT * FROM sessions WHERE (session_id = ''875b6a6dff4de7e8bb2f7709cf9c31db'') LIMIT 1 ... Note: the mongrel cluster is configured to have 3 mongrel processes. Is this a clue why only the first 3 connections allways get the error ? Thanks for your input. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20061010/68babe65/attachment.html