tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin.Manola...@eng.sun.com
Subject Re: commented out setSoTimeout() in EndpointManager
Date Wed, 05 Jan 2000 18:28:54 GMT
Jim Rudnicki wrote:

> 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
> reason....

The reason: kaffe doesn't implement it ( and crashes if it is present ).
Probably kaffe is not so important, but it is the default VM on RedHat
and it was the only change needed to support it.

I don't mind adding the line back, but I'm not sure it's the real problem
in this case - stop() should be able to interupt the listen thread.

Costin



Mime
View raw message