On Mon, Apr 6, 2009 at 11:47 PM, Alan Burlison <[email protected]> wrote:
> We are using the ServletWebServer class, and we are getting occasional
> hangs, where the listener thread gets stuck as follows:
I'll never stop wondering why people are using this stuff for serious jobs.
> The problem is this: when an incoming connection comes in, a new
> HttpServletRequestImpl object is created. The constructor of that class
> reads in the HTTP headers. The problem with *that* is that the
> HttpServletRequestImpl constructor runs in the same thread that accepts
> incoming connections, so if it blocks for any reason (e.g. the client hangs)
> it blocks the accept thread, which means that any new connections also hang.
Interesting. News to me, that the accept thread must not block, but one never
stops to learn.
> Can anyone think of any reasons why this might cause problems? If not I'll
> do the changes and submit a patch.
Please do. Not the first valuable patch from you.
> I also note that Connection class does this:
>
> // set read timeout to 30 seconds
> socket.setSoTimeout (30000);
>
> That *should* mean that the maximum time a client can hang the server for is
> 30 seconds, but by observation that's clearly not happening and needs
> further investigation.
Patches in that area should be welcome as well.
Jochen
--
I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure out
how to use my telephone.
-- (Bjarne Stroustrup,
http://www.research.att.com/~bs/bs_faq.html#really-say-that
My guess: Nokia E50)