tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <>
Subject Re: Purpose of unlockAccept
Date Mon, 07 May 2012 19:49:52 GMT
On 05/07/2012 08:48 PM, Mark Thomas wrote:
> I'm not entirely clear on what you are proposing. Can you provide a
> proposed patch for this?

Need to port that to trunk and new AbstractEndpoint.
Attached is a patch for something similar to tomcat7 :)
just to get an idea.

>> AFAICT this is not covered by any spec and the only
>> change is that a single connection that could get accepted
>> during pause phase can receive ECONNRESET instead ECONNREFUSED
>> in case pause continues beyond client socket timeout.
> That will be bad for connections from a reverse proxy when taking a
> Tomcat instance out of a cluster. I'm leaning towards objecting to this
> patch on that basis alone.

Think not.
Currently acceptor thread waits before calling accept if paused.
The proposed solution will wait after accept returns.
So there are actually two scenarios.
a) Optimistic:
    No connections accepted between pause/start
    This is advantage over current impl, cause no unlock needed.
b) Pessimistic:
    While in pause accept() was fired and new socket created.
    while(pause) { sleep; }
    If stopped destroy socket and quit acceptor.
    If running continue processing accepted socket.

So in the worse case a single connection will get accepted and
sit in the while(paused) { } block.
Note that this is no different then having a backlog of 1 thought.


View raw message