[Mongrel] mongrel.pid disappearing

Massimo Santoli massimo at zero.it
Tue Oct 3 04:37:15 EDT 2006


I finally solved the problem.

I will recap for future memory:
I have installed Ruby 1.8.4 + Rails 1.1.6 + Mongrel 0.3.13.4 on a Linux 
Box - Centos 4.4 - Apache 2.0.59 with proxy pass to a single Mongrel task
( no cluster ).
Everything worked just fine... but after 10/12 hours the mongrel process 
hanged up, both passing trough apache or calling directly the process.
The site had practically no traffic - it was a demo installation.

Trying to kill the process 'nicely': mongrel_rails mongrel::stop didn't 
stop the process, with the command line reporting there was non 
mongrel.pid file, actually
once the file wasn't really there but all the other times the file was 
present.
You had to kill the process in a less more graceful manner ( kill -9 ... 
) and everything started again running.

After a couple of days of killing dead mongrel process, help form this 
list, and looking around in the debugging outputs I finally found this 
ruby trace that gave me some hints ( this trace appears regularly when 
you killed the hanging process ) and the problem was related to a mysql 
connection hanging.


Mongrel::TimeoutError (Mongrel timed out this thread: shutdown):
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:637:in 
`write'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/vendor/mysql.rb:517:in 
`write'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/vendor/mysql.rb:491:in 
`command'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/vendor/mysql.rb:223:in 
`close'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:168:in 
`disconnect!'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_adapter.rb:163:in 
`reconnect!'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:85:in 
`verify!'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:99:in 
`verify_active_connections!'
    
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.r
b:98:in `verify_active_connections!'
    
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:70:in 
`prepare_application'
    
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:37:in 
`dispatch'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:in 
`process'
    /usr/local/lib/ruby/1.8/sync.rb:229:in `synchronize'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:in 
`process'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in 
`process_client'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in 
`process_client'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:267:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:in 
`run'
    
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:211:in 
`run'
    /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231
    /usr/local/bin/mongrel_rails:18


After suggestion on this list to install the mysql gem, and use the 
native driver instead of the ruby one.
I finally manged to solve the problem - the site is running from about 
72hours without a glitch.

Thanks to everybody
Massimo



More information about the Mongrel-users mailing list