Forum: Ruby on Rails 'Mysql has gone away'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5af3b9ce700e50eb46001e0c9bc03f70?d=identicon&s=25 paul.vudmaska (Guest)
on 2005-12-01 16:13
(Received via mailing list)
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
22580f640e491f0920a192610d1df393?d=identicon&s=25 atomgiant (Guest)
on 2005-12-01 17:10
(Received via mailing list)
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
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-12-01 19:12
(Received via mailing list)
On 12/1/05, Paul Vudmaska <paul.vudmaska@gmail.com> 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!  :-)
A2b2f4ee23989dc68529baef9cbddcd6?d=identicon&s=25 listbox (Guest)
on 2005-12-06 20:28
(Received via mailing list)
On 1-dec-2005, at 16:10, Paul Vudmaska 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
This topic is locked and can not be replied to.