Defect #4144

Setting timeout to avoid bug in MySQL driver that causes Mongrel stopping to work after a long idle time

Added by Vadim Epstein over 10 years ago. Updated about 10 years ago.

Status:ClosedStart date:2009-10-30
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Database
Target version:-
Resolution:Wont fix Affected version:0.8.4

Description

Hi,

Mongrel stop working after a long idle time because of bug in MySQL driver that doesn't properly timeout connections. What happens is the MySQL server side of the connection times out and closes, but the MySQL client doesn't detect this and just sits there. As a result Mongrel stops responing until its restart.

The problem is discussed here:
http://www.redmine.org/boards/2/topics/9292

What is necessary to do is to set:
ActiveRecord::Base.verification_timeout = 14400
Or to any value that is lower than the MySQL server's interactive_timeout setting. This will make sure that ActiveRecord checks the connection often enough to reset the connection.

I don't know Ruby. Is there any way to patch this myself or shall I wait for the future Redmine release?

History

#1 Updated by Jean-Philippe Lang over 10 years ago

I never had to use it, but you can try to append this line at the very end of config/envrionment.rb:

  # It will automatically turn deliveries on
  config.action_mailer.perform_deliveries = false
end

ActiveRecord::Base.verification_timeout = 14400

#2 Updated by Vadim Epstein over 10 years ago

I have played with this parametered as advised by this does not help. Mongrel stops working after some time and requires restart.

#3 Updated by Jean-Philippe Lang over 10 years ago

  • Status changed from New to Closed
  • Resolution set to Wont fix

Closing this ticket since it's a deployment issue.
There's nothing I can fix.

#4 Updated by Vadim Epstein over 10 years ago

  • Assignee set to Jean-Philippe Lang

Jean-Philippe,

Who can assist with this then? Mongrel freezes and the problem is not solved. In fact I don't know the actual reason for 100%. But Mongrel keeps freezing.

Please advise where and who I can address this issue to.

Tnanks

#5 Updated by K Purohit over 10 years ago

Vadim,

I had the same issue. I think the problem was that we were running Ruby v.1.8.5 and didn't have the mysql gem installed. This gem needs Ruby v.1.8.6 or above.

How I solved it (on a RHEL5 box) was to update Ruby to 1.8.6 using this repository (you can also compile it yourself; I was being hasty!)

http://repo.premiumhelp.eu/ruby/

Then install the mysql-devel RPM. Now you're ready to install the mysql gem (gem install mysql)

Hopefully, this does the trick. You can also use irb and type:

require 'mysql'

If that doesn't throw any errors, I think you're set after restarting mongrel.

Hope this helps. If there were any errors in my understanding, it's probably because I'm new to the whole Rails thing :)

#6 Updated by Vadim Epstein about 10 years ago

The following workaround was found.

Script has been configured to access list of projects page every 3 minutes.
As far as I understand this forces mogrel to keep mysql connection up and thus redmine works.

Anyway this problem should be fixed in future versions of redmine

Also available in: Atom PDF