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 14 years ago. Updated over 14 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Wont fix
Affected version:



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:

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?

Actions #1

Updated by Jean-Philippe Lang over 14 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

ActiveRecord::Base.verification_timeout = 14400
Actions #2

Updated by Vadim Epstein over 14 years ago

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

Actions #3

Updated by Jean-Philippe Lang over 14 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.

Actions #4

Updated by Vadim Epstein over 14 years ago

  • Assignee set to Jean-Philippe Lang


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.


Actions #5

Updated by K Purohit over 14 years ago


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!)

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 :)

Actions #6

Updated by Vadim Epstein over 14 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