tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol BonnĂ­n <>
Subject Re: Proposal: New parameter for JK2 connector
Date Mon, 23 Feb 2004 19:24:20 GMT
Hi Bill,

>>Seen that mod_jk has a "socket_keepalive" option for the Apache side, my
>>proposal consists in adding a similar setting in the Tomcat side.
>>If you pull the power cord of your Apache server (or something else bad
>>happens to it), Tomcat will notice shortly after, and will close the
>>associated connections, thus freeing threads, which are limited by
>>I know it is an unlikely situation, but I still think it is a good idea.
>>Suggestions welcome!
>It shouldn't be necessary, since the Tomcat side spends most of it's time
>attempting a 'read' on the Socket.  It should throw an IOException as soon
>as Apache drops its end of the Socket (via tripping over the power cord or
>otherwise :).

How would that be possible?

Precisely because Tomcat is idle on a read() call on the socket, several 
things may happen:

1- A packet with data is received.
2- An ACK packet is received (or a keepalive by any means).
3- A FIN or RST or (what was it) packet is received.
4- Nothing is received.

And the OS will:
1- End the read() call by returning the received data to Tomcat.
2- The OS responds to the keepalive or ACK or anything, and Tomcat keeps 
idle on read().
3- The read() call will be aborted, and an exception will be risen.
4- Nothing happens (Tomcat keeps idle on read())

If you pull the porwer cord (or network cable, for this matters), (4) 
will happen. I mean: a dead machine does not (can not) send packets. So 
NOTHING will happen. Tomcat will not notice.

As I tried to show from the beginning...

Please consider that I am not looking into the case where Apache 
*process* dies, in which case (3) will happen, as you said. I really 
mean a *hardware* problem.


Antonio Fiol

P.S.: If it is voted for, I may develop the necessary patch, as it is a 
fairly trivial one.

View raw message