[Mongrel] random cpu spikes, EBADF errors

Wayne E. Seguin wayneeseguin at gmail.com
Tue Oct 23 23:10:13 EDT 2007

On 10/23/07, Zachary Powell <zach at plugthegap.co.uk> wrote:
> In May I had problem with mongrels suddenly consuming huge cpu resources
> for a minute or two and then returning to normal (load average spikes up to
> 3.8 and then back down to a regular 0.2 over the course of 5 minutes, then
> again 1/2 hour later. or 4 hours later, no predictable rhythm).
> I posted to Litespeed forums because I thought the problem was there but
> didn't get far. And a week later migrated hosting companies and the problem
> was gone. Now its returned. We make a lot of changes, but I've gone over the
> repo for the last few weeks and can't see anything structural that should
> effect it. It only happens with our main front end app (the other two are
> fine), but happens at all times of day(/night) so doesn't seem triggered by
> a heavy load. Basically a mongrel gets stuck on one or two cached files for
> a few minutes (but still functions fine for other requests, I can ping
> specific rails pages on all mongrels during this period).
> strace -e read,write,close produces this repeatedly the whole time (short
> excerpt of 1000s of lines):
>  close(5)                                = -1 EBADF (Bad file descriptor)
> read(5, "GET /flower_delivery/florists_in_covehithe_suffolk_england_uk
> HTTP/1.1\nAccept: image/gif, image/x-xbitmap, image/jpeg, image"..., 16384)
> = 473
> <snip>

It appears that the file is either being prematurely closed, doesn't exist
or some other file related error is occurring.

Please give us the details of your setup and architecture.

The first thing I would check is your open file limit. If this process is
opening more files than the user it is running as is allowed to open, then
the OS will begin denying the process files it tries to open. This can be
caused either by bad code not closing files or perhaps your app simply has
to open that many files due to application design and load. Either way,
check the limit and compare to how many files the process has open at the
time you see this occurring.

I hope that this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20071023/eea455c7/attachment.html 

More information about the Mongrel-users mailing list