Bug 41530 - stopping a connector produces intermittent SocketException
stopping a connector produces intermittent SocketException
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
All Mac OS X 10.4
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2007-02-02 11:22 UTC by Paul McMahan
Modified: 2009-07-18 06:40 UTC (History)
0 users

patch avoids logging SocketException when endpoint has been stopped (675 bytes, patch)
2007-02-02 11:25 UTC, Paul McMahan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul McMahan 2007-02-02 11:22:54 UTC
Geronimo embeds tomcat by wrappering org.apache.catalina.startup.Embedded as a
gbean.  Geronimo stops an http connector by calling the stop() method of
org.apache.catalina.connector.Connector.  Depending on the current state of the
connector when it is stopped, the socket connected to it can throw the following

Feb 2, 2007 2:20:05 PM org.apache.tomcat.util.net.JIoEndpoint$Acceptor run
SEVERE: Socket accept failed
java.net.SocketException: Socket closed
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
        at java.net.ServerSocket.implAccept(ServerSocket.java:450)
        at java.net.ServerSocket.accept(ServerSocket.java:421)
        at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)
        at java.lang.Thread.run(Thread.java:613)

This behavior is intermittent but occurs frequently in the unit test cases for
Geronimo's tomcat gbean and when the Geronimo server is shut down.

The exception occurs when the socket opened by JIoEndpoint.Acceptor.run() is
closed by JIoEndpoint.unlockAccept().  In that case it seems that the
SocketException should be ignored.  Checking to see if the JIoEndpoint is
actually running before logging the error is one way to avoid this problem.  I
will attach a patch for that approach shortly.
Comment 1 Paul McMahan 2007-02-02 11:25:03 UTC
Created attachment 19501 [details]
patch avoids logging SocketException when endpoint has been stopped

patch created against https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk
Comment 2 Konstantin Kolinko 2009-07-18 06:40:56 UTC
Fixed in 6.0.11. I am changing status from VERIFIED to CLOSED.