Bug 53186 - JIoEndpoint LimitLatch will leak if setsockopt is called on a closed socket on Solaris
JIoEndpoint LimitLatch will leak if setsockopt is called on a closed socket o...
Status: RESOLVED DUPLICATE of bug 53173
Product: Tomcat 7
Classification: Unclassified
Component: Connectors
7.0.20
Sun Solaris
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-05-03 17:50 UTC by parker0phil
Modified: 2012-05-07 12:47 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description parker0phil 2012-05-03 17:50:43 UTC
Overview Description:

org.apache.tomcat.util.net.AbstractEndpoint uses a org.apache.tomcat.util.threads.LimitLatch to limit the amount of connections to whatever was set using the maxConnections property of the connector.

In the org.apache.tomcat.util.net.JIoEndpoint implementation this is incremented as part of the main Acceptor run method (JIoEndpoint:204) but only decremented during a specific case of SocketProcessor.run()(JIoEndpoint:310).

If for any reason line 310 does not execute then, over time, the limitlatch will steadily increment with no possibility of decrementing. Until the limit is reached and no more connections can be serviced.

In my particular case the problem occurs when the setSocketOptions method is called (JIoEndpoint:221) and the native implementation of PlainSocketImpl causes an error due to the socket being closed (as described in the comment on line 942 of http://cr.openjdk.java.net/~chegar/6882910/webrev.00/webrev/src/solaris/native/java/net/PlainSocketImpl.c.frames.html)

Steps to Reproduce: 

Can't reproduce in isolation (due to unknown root cause creating initial error in native code). Reproducible under load in Performance and Production environments.

Reading the code shows a number of possible reasons why this COULD happen.

Actual Results: 

The container stops responding to requests. 

The process continues to run and scheduled tasks etc will continue occuring and logging. Can't even telnet to the port (as the Acceptor thread is blocked by the LimitLatch).

Additional Builds and Platforms:

 - Occurs On
        Solaris 

 - Doesn't Occur On
        Linux (although I would expect any other intermittent exception in JIoEndpointsetSocketOptions or JIoEndpoint$SocketProcessor.run() to produce the same result on any platform)
Comment 1 Rainer Jung 2012-05-03 19:15:33 UTC
There might be some relation to BZ53173
Comment 2 parker0phil 2012-05-03 21:25:01 UTC
Yep looks like a different instance of the same problem to me, didn't find that in my search.

(In reply to comment #1)
> There might be some relation to BZ53173
Comment 3 Pid 2012-05-04 07:03:01 UTC
I concur, but I'd suggest we leave it open for Filip to review.
Comment 4 Filip Hanik 2012-05-07 12:47:40 UTC
That is correct. Thank you for the report. It has been fixed.

https://issues.apache.org/bugzilla/show_bug.cgi?id=53173

*** This bug has been marked as a duplicate of bug 53173 ***