There are some known issues, I've commented on this before, check out the thread: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/c07682cbfb2eef60/c3604401b504de96#c3604401b504de96
** Warning total hack**
You can actually get rid of this error by making a sleeper thread that wakes up and verifies the database connection. Add this to the bottom of your environment.rb file:
Thread.new{ loop{ sleep(60*60); ActiveRecord::Base.verify_active_connections! } }.priority = -10
That will wake up one an hour and verify the active database connections. Adjust the time to suit your situation. Note that this only addresses the issue with the database connection timeout. There are some other things that can cause the loas connection error that this does not fix.
Cheers
-- Ezra Zygmuntowicz-- Lead Rails Evangelist -- ez@engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
My question now is: Is there any movement yet on being able to actually access the mysql reconnect setting from the rails/mongrel configuration somewhere, so that the app can just reconnect to mysql when it needs to? I'm really quite surprised that an issue like this would even be allowed into production applications written in Rails, yet people are using it all over. Is there an acceptable solution to this problem that doesn't require a hack of the mysql driver code or a sleeper thread bandaid?
Thanks in advance, Lee
Google query for rails how to set mysql to reconnect revealed this (if helpful) http://wooga.drbacchus.com/rails-and-mysql-timeouts