David Harkness
2008-Feb-29 14:42 UTC
Dealing with MySQL disconnects on long running scripts.
Would anyone happen to have some advise for this? I have a script that runs for months at a time. On one box, I can do this without issue, on another it disconnects after a day. I''ve been trying various solutions, but since it takes a day to test any idea, it''s been very slow going. I''ve tried Issuing a reconnect command, after any ActiveRecord error. Which didn''t help. I''m using a socket connection, not a hostname I''m using the compiled version of the gem. -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Feb-29 15:25 UTC
Re: Dealing with MySQL disconnects on long running scripts.
On 29 Feb 2008, at 14:42, David Harkness wrote:> > Would anyone happen to have some advise for this? > > I have a script that runs for months at a time. > > On one box, I can do this without issue, on another it disconnects > after > a day. > > I''ve been trying various solutions, but since it takes a day to test > any > idea, it''s been very slow going. > > I''ve tried Issuing a reconnect command, after any ActiveRecord error. > Which didn''t help. >Have you tried setting the active record verification_timeout to be less than whatever timeout has been set on mysql ? Fred> I''m using a socket connection, not a hostname > > I''m using the compiled version of the gem. > -- > 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?hl=en -~----------~----~----~----~------~----~------~--~---
David Harkness
2008-Feb-29 16:04 UTC
Re: Dealing with MySQL disconnects on long running scripts.
Been a long time since I tried that, I''ll give it another go. I''ve seen people complain about it before, but it seems really strange that there isn''t an easy way to force active-record to reconnect after a disconnect. From script/console, the following works. Mymodel.new.save #works Mymodel.connection.disconnect! Mymodel.new.save # toss an error. Mymodel.connection.reconnect! Mymodel.new.save # works Yet the equivalent doesn''t seem to work in a long running script. I''ll continue poking at it Thanks for the advise Frederick Cheung wrote:> On 29 Feb 2008, at 14:42, David Harkness wrote: > >> any >> idea, it''s been very slow going. >> >> I''ve tried Issuing a reconnect command, after any ActiveRecord error. >> Which didn''t help. >> > Have you tried setting the active record verification_timeout to be > less than whatever timeout has been set on mysql ? > > Fred-- 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?hl=en -~----------~----~----~----~------~----~------~--~---