Mongrel hangs when idle

Hello All,

This issue has been raised by so many people in this forum and in the
web before.
But i am not sure, whether all of those got fixed the issue.

My application is running in
1)rails 2.2.2
2)ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]
3)MySQL 5.1.30-ndb-6.3.20-cluster-gpl MySQL Cluster Server (GPL)
4)Apache/2.2.3 + mongrel_cluster(1.0.5)

The mongrel is hanged when it is idle for some time.
I don’t get any errors in the logs.

When i googled about this, i found the Mongrel FAQ page -
http://mongrel.rubyforge.org/wiki/FAQ which says to set
ActiveRecord::Base.verification_timeout = 14400. when i added this in
environment.rb i got warning as below:

DEPRECATION WARNING: ActiveRecord::Base.verification_timeout= has been
deprecated and no longer has any effect.

So the above solution failed.

I tried so many trials like increasing MySQL interactive_timeout to a
high value, updating the mysql gem etc… But no luck.

After so many trials and search i found that this issue rises only in
production mode. That is when config.cache_classes is set to true

In my stage environment also i am having the same configuration as my
production(rails, ruby, mysql, apache and mongrel_cluster). That is
config.cache_classes is set to true.

So, when config.cache_classes = true, the mongrel hangs up after a long
idle time. When its is set to false, everything is O.K

I doubt whether this(config.cache_classes = true) is the cause of the
issue.
I am not sure whether DB connections are also cached if
config.cache_classes is set to true.

Please help me in solving the issue.

Any of your suggestions will be very helpful to me.

Thanks in advance

Murugaraj B.

Hi Muruga R.

    Though I am not sure I have once read somewhere that you can 

setup a cron job to access say your home page every 5 or 10 minutes so
to wakeup it on these regular intervels.But the above I read to avoid
delay in loading first page after some time of idleness. But in your
case it is hanging
As an example crontab -e

*/5 * * * * curl -s http://www.your_domain.com /dev/null

  Please check right syntax for this

Sijo

Sijo k g wrote:

Hi Muruga R.

    Though I am not sure I have once read somewhere that you can 

setup a cron job to access say your home page every 5 or 10 minutes so
to wakeup it on these regular intervels.But the above I read to avoid
delay in loading first page after some time of idleness. But in your
case it is hanging
As an example crontab -e

*/5 * * * * curl -s http://www.your_domain.com /dev/null

  Please check right syntax for this

Sijo

Hello sijo,

Thank you for your suggestion.
I am already using the cronjob you mentioned.

Anyway i need a permanent solution for this.

Thank you once again.