[Mongrel] Mongrel error : EMFILE too many open files
luislavena at gmail.com
Mon Dec 17 14:18:51 EST 2007
On Dec 17, 2007 12:16 PM, Scott Derrick <lists at ruby-forum.com> wrote:
> Kirk Haines wrote:
> > Nobody else has said it, so I will.
> > This is not a Mongrel problem.
> 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
First, sorry If I'm not polite enough, but why you upgrade something
if isn't broken?
Also, why did you upgrade a production site/application without prior
sandboxing/staging test of it?
> 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.
Mongrel isn't crashing, the app that runs on top of it isn't returning
control to it to keep serving request. Both Mongrel and Rails share
the same process:
Rails is a web framework that needs a HTTP server.
Mongrel is an HTTP server that parse HTTP request and send them to Rails.
Rails (not ruby) is unsafe to handle more than 1 request at the time,
that's why you need a cluster of mongrels to server a middle-to-high
Draw a line between them. Mongrel do not crash your application, your
application isn't returning control to Mongrel to keep serving other
Also you should start checking your log files to see what was the
latests request served by your rails application, if somehow that
could help you.
> That makes it a Mongrel problem in my eyes, at least to anybody who
> cares if Mongrel is reliable or not.
Again, you should take as policy test everything in development, then
staging and _then_ production.
Blaming Mongrel because your rails application hang isn't something
will help you get the right answer to fix your problem.
To consider it a problem, you should also need to test other
scenarios, which you didn't.
a plain script/server webrick -e production worked for you? I know
that will not be performance wise, but at least, you can see what
Also you can test the FastCGI scenario and see if that work.
The EMFILE limit is because something in Rails side is exhausting file handles:
too many render :partial
too many orphaned (not garbage collected TempFiles)
PStore is a option of session storage of Rails, not Mongrel. PStore
uses 1 temp file per session, being a session each individual user
requesting a page.
You need to look at Rails documentation to properly upgrade your Rails
1.x application to 2.x, and do it on testing before doing on
A common mistake that people make when trying to design
something completely foolproof is to underestimate
the ingenuity of complete fools.
More information about the Mongrel-users