'Mysql has gone away'

I’m using EdgeRails from SVN on TextDrive. I’m often getting ‘Mysql
has gone away’ errors and my understanding is this is an issue with
EdgeRails that is being addressed. Can anyone verify that for me?

I’m having some folks test things and I wanted to make sure my app was
staying up, so in rescue_action_in_public, I’m executing an .sh file
that kills and restarts lighty. I can run this code on my local - but
of course it is not happening here (i’m using lighty locally also -
but I forced it to run in a controller and it restarted Lighty without
problems)

Is that a dumb idea? Can you imagine any ill effects to others on TD?

Thanks to all!

:Paul

You are correct. Here is a the ticket for this issue:

http://dev.rubyonrails.org/ticket/428

I am not sure about your proposal to restart lighty… someone said
this could happen every 10 minutes. I have personally switched to the
stable for now:

http://dev.rubyonrails.org/svn/rails/branches/stable

It was said that this issue is one of the last to be fixed before
1.0… so hopefully it won’t be broken much longer.

Tom

On 12/1/05, Paul V. [email protected] wrote:

I’m using EdgeRails from SVN on TextDrive. I’m often getting ‘Mysql
has gone away’ errors and my understanding is this is an issue with
EdgeRails that is being addressed. Can anyone verify that for me?

Thank god someone else is having the same problem as me! :slight_smile:

On 1-dec-2005, at 16:10, Paul V. wrote:

Is that a dumb idea? Can you imagine any ill effects to others on TD?

Yes, it is - you are shooting birds with a cannon, so to speak.

If you want your app to be accessible, do SOME request in your
prefilter and then catch it’s exception. If you get an exception with
“MySQL has gone away” etc. it’s time to reconnect.

This is NOT clean and it shoulodn’t be done in this way butthe ticket
has all the implications that you can read about.

begin
ActiveRecord::Base.connection.execute “SET NAMES
your_favorite_charset_here”
rescue ActiveRecord::StatementInvalid => e
if e.to_s =~ /away/
ActiveRecord::Base.establish_connection and retry
else
raise e
end
end

To be precise I would put another throw(:on_reconnect) in there just
to make sure this doesn’t happen indefinitely. I never noticed
reconnection issues exactly because I’ve been using this since like
May this year on all apps I develop.


Julian ‘Julik’ Tarkhanov
me at julik.nl