[Mongrel] Error: Mongrel timed out this thread: too many open files

Zed A. Shaw zedshaw at zedshaw.com
Thu May 29 17:02:56 EDT 2008

On Thu, 29 May 2008 13:07:27 -0700
"Emmett Shear" <emmett at justin.tv> wrote:

> I just switched to Mongrel, and it's been working much better than my
> previous lighttpd/fastcgi setup. So thanks for the awesomeness.
> My current problem: once or twice an hour, I get following error in
> production
> Mongrel timed out this thread: too many open files
> I never get it in testing or on our staging server. Any ideas what would
> cause that? It doesn't *appear* particularly correlated with load to me, but
> I'm only receiving notifications after the fact so I can't be sure.

A couple things cause this.  One is that the mongrel is overloaded with
too many connections so it can't accept any more.

If there's isn't that much load on the server, then it's more likely
that you are leaking an open file here or there.  If you are doing code
like this:

a = open("blah.txt")

Then you are probably leaking files.  Look for that, and then translate
to the block form:

open("blah.txt") {|a| a.write("hi") }

That's probably the #1 mistake people make from other languages.

Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/

More information about the Mongrel-users mailing list