Homer Simpson
2008-Jan-08 13:31 UTC
Sporadically getting error Mysql::Error: Lost connection
I just setup Rails on Centos5. I have a remote MySQL 4.1 server. I am able to successfully connect to MySQL with rails and it works fine most of the time. However, I get the following error every once in a while (not always on the same query): Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS FROM groups_rights Any idea what might be causing this? There doesn''t appear to be any packet loss between the 2 servers. -- 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan
2008-Jan-08 13:50 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Do you have the mysql-ruby bindings installed? I don''t know how you installed Rails and / or Ruby on your system. Some distros have this as a package. You could also install it with gems sudo gem install mysql provided that you have everything set up right on your box (paths, compilers, etc), I don''t know Centos at all, so I won''t be much more help than that. However, I''ve seen that error before whenever I had heavy dtabase access in my Rails apps and they were using the Mysql libraries that comes with Rails rather than the much faster C bindings I talked about here. Hope that helps you some. On Jan 8, 2008 7:31 AM, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I just setup Rails on Centos5. I have a remote MySQL 4.1 server. > > I am able to successfully connect to MySQL with rails and it works fine > most of the time. > > However, I get the following error every once in a while (not always on > the same query): > > Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS > FROM groups_rights > > Any idea what might be causing this? There doesn''t appear to be any > packet loss between the 2 servers. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 14:03 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Thanks for the reply I installed mysql via: gem install mysql --with-mysql-config=/usr/bin/mysql_config I figure if there was a problem with this then I would not be able to connect at all, right? -- 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan
2008-Jan-08 14:23 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Not necessarily. Rails could still be using the native one. If you do gem list mysql does it show up on the list? If it does then I have no idea what''s wrong. If it doesn''t show up then it didn''t install (that''s happened to me as well) On Jan 8, 2008 8:03 AM, Homer Simpson <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Thanks for the reply > > I installed mysql via: > > gem install mysql --with-mysql-config=/usr/bin/mysql_config > > I figure if there was a problem with this then I would not be able to > connect at all, right? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 14:30 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Here is what I get - seems about right, correct?>gem list mysql*** LOCAL GEMS *** mysql (2.7) MySQL/Ruby provides the same functions for Ruby programs that the MySQL C API provides for C programs. I just enabled MySql logging and I see the query (an update query in this case) being executed and the rolled back. -- 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-Jan-08 14:37 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
On 8 Jan 2008, at 13:31, Homer Simpson wrote:> > I just setup Rails on Centos5. I have a remote MySQL 4.1 server. > > I am able to successfully connect to MySQL with rails and it works > fine > most of the time. > > However, I get the following error every once in a while (not always > on > the same query): > > Mysql::Error: Lost connection to MySQL server during query: SHOW > FIELDS > FROM groups_rights >Does this happen after long periods of inactivity? Have you tried setting config.active_record.verification_timeout You need to set it to something lower than whatever your mysql connection timeout setting is. Fred> Any idea what might be causing this? There doesn''t appear to be any > packet loss between the 2 servers. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 14:44 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
> Does this happen after long periods of inactivity?No, actually, it seems to happen a lot shortly after I restart the mongrel process. It doesn''t usually happen on the first hit after the restart so I know its making the initial connection OK. -- 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 16:16 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
For the fun of it I installed MySQL 5 on the same server that rails is on and I can duplicate this problem. This is feeling like a problem with the mysql-ruby stuff, doesn''t it? Any suggestion on how to proceed on troubleshooting? -- 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 16:59 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Is there anyway to verify that the mysql gem is actually being used? I uninstalled the mysql gem and I see the same problem. I tried installing like this: gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql (the above was taken from http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems - CentOS 4.5 section) Its starting to feel like the gem is not even being used. I have another environment that is on RHEL3 and I don''t have these issues there. -- 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-Jan-08 17:36 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
On 8 Jan 2008, at 16:59, Homer Simpson wrote:> > Is there anyway to verify that the mysql gem is actually being used? >put raise ''Bananarama'' somewhere appropriate in the mysql/ruby driver. if you see bananarama then you''ll know that you''re not running the gem Fred.> I uninstalled the mysql gem and I see the same problem. > > I tried installing like this: > gem install mysql -- --with-mysql-include=/usr/include/mysql > --with-mysql-lib=/usr/lib/mysql > > (the above was taken from > http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems - > CentOS 4.5 section) > > Its starting to feel like the gem is not even being used. I have > another environment that is on RHEL3 and I don''t have these issues > there. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 19:22 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Thanks Fred - I''ll try that out a little later (have a meeting in a min) - but one more clue: This is only happening when using the active_record_store to store sessions. I canno duplicate when writing session info to file. I can see in the SQL log that "sometimes" when it does the query to update the session it creates a new connection to the db (as opposesed to using the connection that rails process has already created - that is when the error occurs. Most of the time the session query is using the same connection as the rest of the queries. Thought I''d post that bit of information in the event it rings a bell for anyone. -- 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 -~----------~----~----~----~------~----~------~--~---
Raymond O''Connor
2008-Jan-08 21:07 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Maybe there''s some clues in your mysql error log? There may be something wrong with the table. I''ve gotten similar behavior to this once when I redefined the size of the innodb data files. -- 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 -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-08 21:26 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Raymond O''Connor wrote:> Maybe there''s some clues in your mysql error log? There may be > something wrong with the table. I''ve gotten similar behavior to this > once when I redefined the size of the innodb data files.No, nothing in the error log -- 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 -~----------~----~----~----~------~----~------~--~---
Hiroki Yoshioka
2008-Jan-09 00:25 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
> Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS > FROM groups_rightsthere''s a gem to workaround this problem: google ''mysql_retry_lost_connection''. hiro --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It could be something else that I was experiencing also. Does your program make concurrent threads? If it does, make sure you create a semaphore because there is a know bug in webrick that leads to Mysql Lost connection. http://wiki.rubyonrails.org/rails/pages/HowTosWorkerThreads On Jan 9, 2008 1:25 AM, Hiroki Yoshioka <irohiroki-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS > > FROM groups_rights > > there''s a gem to workaround this problem: > google ''mysql_retry_lost_connection''. > > hiro > > > > >-- --------------------------------------------------------- Javier Quevedo Fernández jquevedo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Spain +34 618 420 028 Netherlands +31 619 347 865 http://senc.yoteinvoco.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Homer Simpson
2008-Jan-09 14:18 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
I put a debug in the mysql_adapter and indeed the ruby version of mysql is being used. I just need to figure out why - it has something to do with the RubyWorks Production Stack installation. I did not use this on my RHEL 3 machine - so, that explains why its working OK there. Thanks for all your help so far! -- 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 -~----------~----~----~----~------~----~------~--~---
Anyone have opinions on what payment processors are best? I am using Payflow right now wondering if I should change or keep using it. Plan on using ActiveMerchant so want something that it supports. Any opinions or recommendations out there? thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
PhilAlanThompson-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2008-Jan-10 16:28 UTC
Re: Sporadically getting error Mysql::Error: Lost connection
Actually, you can just check the development.log to see if you are using the correct bindings. If not you''ll get this: WARNING: You''re using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C- based MySQL library instead (gem install mysql). Interestingly I have done ''gem install mysql'' and I still get this warning. Phil On Jan 8, 5:36 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8 Jan 2008, at 16:59, Homer Simpson wrote: > > > > > Is there anyway to verify that the mysql gem is actually being used? > > put > raise ''Bananarama'' > somewhere appropriate in the mysql/ruby driver. if you see bananarama > then you''ll know that you''re not running the gem > > Fred. > > > I uninstalled the mysql gem and I see the same problem. > > > I tried installing like this: > > gem install mysql -- --with-mysql-include=/usr/include/mysql > > --with-mysql-lib=/usr/lib/mysql > > > (the above was taken from > >http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems- > > CentOS 4.5 section) > > > Its starting to feel like the gem is not even being used. I have > > another environment that is on RHEL3 and I don''t have these issues > > there. > > > -- > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Actually, you can just check the development.log to see if you are using the correct bindings. If not you''ll get this: WARNING: You''re using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C- based MySQL library instead (gem install mysql). Interestingly I have done ''gem install mysql'' and I still get this warning. Phil On Jan 8, 5:36 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8 Jan 2008, at 16:59, Homer Simpson wrote: > > > > > Is there anyway to verify that the mysql gem is actually being used? > > put > raise ''Bananarama'' > somewhere appropriate in the mysql/ruby driver. if you see bananarama > then you''ll know that you''re not running the gem > > Fred. > > > I uninstalled the mysql gem and I see the same problem. > > > I tried installing like this: > > gem install mysql -- --with-mysql-include=/usr/include/mysql > > --with-mysql-lib=/usr/lib/mysql > > > (the above was taken from > >http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems- > > CentOS 4.5 section) > > > Its starting to feel like the gem is not even being used. I have > > another environment that is on RHEL3 and I don''t have these issues > > there. > > > -- > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---