[Mongrel] Nightly mongrel issues...
zedshaw at zedshaw.com
Sat Apr 29 15:33:09 EDT 2006
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
2. Write a Watir or Selenium test that goes through your application like a
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?
On 4/28/06 10:48 AM, "Jeremy Hopple" <jeremy at jthopple.com> wrote:
> 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
> Dispatcher.dispatch (cgi,
> ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
> 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'
> <http://0.3.12.4/lib/mongrel/rails.rb:64:in> `process'
> <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'
> <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'
> <http://0.3.12.4/lib/mongrel.rb:483:in> `run'
> <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'
> <http://0.3.12.4/bin/mongrel_rails:97:in> `run'
> <http://0.3.12.4/lib/mongrel/command.rb:163:in> `run'
> If anyone has any ideas please let me know... I promise I'll jump up and down!
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mongrel-users