[Mongrel] random cpu spikes, EBADF errors

Evan Weaver evan at cloudbur.st
Mon Oct 29 19:47:29 EDT 2007


The Camping handler already has in-Mongrel support for X-SENDFILE. It
would make sense to add a configurable option to the DirHandler and
Rails handler as well as the Camping handler to actually pass the
header along to webservers that support it, so it does what it's
supposed to instead of faking it. Also, X-SENDFILE was actually
invented by lighttp, so it's not a super-proprietary thing if you're
concerned about that.

On the other hand, if the webserver doesn't have a superset of
permissions the mongrel does, it could blow up, and if it does, it
could possibly be a vector for security breaches.

However the X-SENDFILE code in the Camping handler should probably be
moved into core somewhere instead of the handler, it's kind of a weird
place to have it.

Just saying. I definitely understand your concerns.

Really the issue is whether we should return any response when closing
a connection due to resource overloading, I think.

Evan

On Oct 29, 2007 7:18 PM, Will Green <will at hotgazpacho.com> wrote:
> I disagree. As soon as you start putting code specific to other web servers in the core Mongrel,
> you'll either have to start adding it for other servers as well (thus bloating the code!), or take a
> stance on which other servers to support. I think this goes completely against Zed's originally vision.
>
> Zed has written several times about how easy it is to create your own handler (I believe as a Gem
> plugin), and to configure Mongrel to use it. Plus, if you bundle it as a plugin, you can distribute
> it separately from the Mongrel core, so those of us who don't need it won't have to load code for
> program we choose not to run.
>
> ==
> Will Green
>
>
> Evan Weaver wrote:
> > Perhaps you are exhausting the number of worker threads in the queue
> > available to mongrel (default 900ish I think). If your cached files
> > are very big, maybe they aren't being served quickly enough by the
> > DirHandler and your queue becomes clogged.
> >
> > Should mongrel definitely send 503 after this state, or not? I think
> > there was some debate recently about the same issue and the resolution
> > was inconclusive.
> >
> > Does Litespeed support x-sendfile? Maybe the DirHandler should be
> > updated to take advantage of that.
> >
> > Evan
> >
> > On Oct 29, 2007 4:27 PM, Robert Mela <rob at robmela.com> wrote:
> >>  > When mongrel was working, it should send the reply back to LSWS
> >> before closing the socket.
> >>
> >> There's a string prepared for the purpose in mongre.rb
> >>
> >>     ERROR_503_RESPONSE="HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze
> >>
> >> It's a one-liner to send that to the socket before calling close.
> >>
> >>
> >> Zachary Powell wrote:
> >>> Hi All,
> >>>
> >>> Follow up to the CPU/EBADF issue I was having with lsws:
> >>>
> >>>
> >>> http://www.litespeedtech.com/support/forum/showthread.php?t=1012&goto=newpost
> >>> <http://www.litespeedtech.com/support/forum/showthread.php?t=1012&goto=newpost>
> >>> Here is the message that has just been posted:
> >>> ***************
> >>> The problem is on mongrel side. As shown in the strace output, file
> >>> handle 5 is the reverse proxy connection from LSWS to mongrel. Mongrel
> >>> read the request, then it closed the connection immediately without
> >>> sending back anything, then try to close it again with result EBADF,
> >>> because the file descriptor has been closed already.
> >>>
> >>> When mongrel was working, it should send the reply back to LSWS before
> >>> closing the socket.
> >>>
> >>> The root cause of the problem is on Mongrel side, however, LSWS should
> >>> fail the request after a few retries. We will implement that in our
> >>> 3.3 release.
> >>> ***************
> >>>
> >>>
> >>> Zach
> >>
> >> _______________________________________________
> >> Mongrel-users mailing list
> >> Mongrel-users at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/mongrel-users
> >>
> >
> >
> >
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>



-- 
Evan Weaver
Cloudburst, LLC


More information about the Mongrel-users mailing list