tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Rudnicki <>
Subject commented out setSoTimeout() in EndpointManager
Date Sat, 01 Jan 2000 00:16:14 GMT

In class EndpointManager, method addEndpoint() at line 242 is:
   // ss.setSoTimeout(timeout);
For some reason, the timeout has been removed.

Without the timeout enabled on the ServerSocket, the Endpoints are not
shutting down.  Instead the Endpoints are blocked indefinitely  at line 114
  Socket socket = serverSocket.accept();
The Endpoints are written to deal with the timeouts by catching
InterruptedIOException and continuing on.

The effect of this is that the server does not stop() fully.  The Endpoints
never inform the manager thru notifyEndpointDown().  Most important, the
socket stays connected because the Endpoint thread is blocked forever.  In
the standalone application, the sockets get torn down when the application
exits, so all appears well.

I detected this problem when using the HttpServer embedded in another
application.  The server start()'s and runs, and appears to stop().  But, if
in the same application instance you try to start() a new instance of the
HttpServer, it fails indicating that the port is in use.  Indeed, the port
is in use because the old Threads are still running and holding onto the
Socket objects.

The commented out line is present In the 3.0 release source code and is
still present in the snapshot code dated Dec 31,1999.  It would be tempting
to just remove the comment, but then again, somebody marked it out for a

Happy New Year,

View raw message