Title: Re: [Mongrel] Nightly mongrel issues...
Usually this happens if you have a Rails handler that gets to a point and then stops for some reason.  Since Mongrel has a lock around the dispatcher, and you’ve got an action that isn’t exiting, then all subsequent requests will become jammed.

Typical things that can do this are not closing files, forking or spawning processes and not waiting for them, connecting to remote servers that don’t answer right away, and even opening too many files.  Look for any actions which could possibly cause something like this, especially if you’re using an external program to do some processing.

I’ve added a –B option and also created a small set of debugging handlers which dump lots of information for you.  It slows your application down, so the best way to do it is this:

  1. Run mongrel with –B so it dumps thread, memory, etc. information to log/mongrel_debug/*.log files.
  2. Write a Watir or Selenium test that goes through your application like a user.
  3. Run the test and watch the mongrel_debug logs, paying attention to the ones reporting files and threads.
  4. If you see an action that seems to have lots of objects created, lots of threads left open, or dangling files then that’s probably the one.
  5. Go in and fix it.

If you’re able to let me view your code, I’d like to work through this with you.  It’s a very common problem but I’d like to go through helping someone fix it.  Can you get together with me at some point?

Zed


On 4/28/06 10:48 AM, "Jeremy Hopple" <[EMAIL PROTECTED]> wrote:

Hi,

I have Apache (2.2) setup to proxy requests through to Mongrel (0.3.12.4 <http://0.3.12.4> ) for a Rails (1.1.2) application (on ruby 1.8.4).  The setup is great, but I'm experiencing some nightly failures.  I thought I'd post here before digging in too deeply, but it looks like Rails is going into lala land and Mongrel can't recover...

Seems like everything gets all backed up in mongrel/rails.rb:64 at:

@guard.synchronize do
              # Rails is not thread safe so must be run entirely within synchronize
              Dispatcher.dispatch (cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
end

Prior to doing a "mongrel_rails restart" the mongrel log is normal and there's nothing unusual in my rails log.  Once I do a "mongrel_rails restart," I get a bunch of the following dumped into the mongrel.log (I assume one for each thread that's chillin' at @guard.synchronize)...

Error calling Dispatcher.dispatch #<Mongrel::StopServer: Timed out thread.>
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.12.4/lib/mongrel.rb:472:in <http://0.3.12.4/lib/mongrel.rb:472:in>  `lock'
/usr/local/lib/ruby/1.8/thread.rb:133:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/rails.rb:64:in  <http://0.3.12.4/lib/mongrel/rails.rb:64:in>  `process'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:425:in <http://0.3.12.4/lib/mongrel.rb:425:in>  `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.12.4/lib/mongrel.rb:424:in <http://0.3.12.4/lib/mongrel.rb:424:in>  `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:495:in <http://0.3.12.4/lib/mongrel.rb:495:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.12.4/lib/mongrel.rb:494:in <http://0.3.12.4/lib/mongrel.rb:494:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:483:in <http://0.3.12.4/lib/mongrel.rb:483:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:774:in <http://0.3.12.4/lib/mongrel.rb:774:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.12.4/lib/mongrel.rb:772:in <http://0.3.12.4/lib/mongrel.rb:772:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:97:in <http://0.3.12.4/bin/mongrel_rails:97:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel- 0.3.12.4/lib/mongrel/command.rb:163:in <http://0.3.12.4/lib/mongrel/command.rb:163:in>  `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:194  <http://0.3.12.4/bin/mongrel_rails:194>
/usr/local/bin/mongrel_rails:18

If anyone has any ideas please let me know... I promise I'll jump up and down!

Thanks,
Jeremy


_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to