[Mongrel] Mongrel error : EMFILE too many open files

Kirk Haines wyhaines at gmail.com
Mon Dec 17 11:35:50 EST 2007

On Dec 17, 2007 8:16 AM, Scott Derrick <lists at ruby-forum.com> wrote:

> thats certainly possible thats its not a problem specific to Mongrel. I
> think its more likely related to my upgrade to Ruby 2.0.1.  Its also
> possible its a CGI problem as CGi is used for session store to memory or
> pstore.

Not Ruby 2.0.1.  It doesn't exist.

Rails 2.0.1?

Ruby != Rails.


> It is odd that what ever the problem, Mongrel crashes..  It won't
> respond to any http request from any client. Its dead in the water.
> That makes it a Mongrel problem in my eyes, at least to anybody who
> cares if Mongrel is reliable or not.

No, it doesn't, because it doesn't have anything to do with _mongrel_

The problem is related to Rails deadlocking.  When that happens,
control never returns to Mongrel; it is out of Mongrel's control.
It's something happening inside of either the Rails code or your
application's code.  It is not happening in Mongrel's code.  Mongrel
is a software component that is responsible for a narrow range of

1) It receives HTTP requests, and parses them.

2) It determines, based on the request uri, which of it's registered
handlers should handle the request.

3) It calls the handler, handing it request and response objects.

4) There are some differences in how the handlers for various
frameworks actually work, but in the end they all do one thing that is
the same -- they pass control from the handler into the framework's

5) Session handling occurs here, inside of the framework's code, which
includes the code for your application.  As does the rest of whatever
your application does to construct it's response.

6) When the framework/app code finishes constructing the response,
control flows out of the handler and back to Mongrel.

7) Mongrel sends the response.

That's the basic cycle of operation.  Your problem is almost certainly
inside #5.

Kirk Haines

More information about the Mongrel-users mailing list