You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Asankha C. Perera" <as...@apache.org> on 2013/11/18 03:12:09 UTC

Stale connection checking with NIO

Hi Oleg

To a previous reply [1] on this list you said: "The stale connection 
check is needed for blocking connections only as the blocking I/O model 
provides no way of finding out whether a connection is half-closed 
unless a attempt is made to read from the underlying socket. 
Non-blocking connections can immediately react to I/O events due to 
their asynchronous nature and can either be open or closed, but never 
stale."

We are seeing something very similar to a stale connection when we try 
to re-use a keep-alive connection. Although I still do not have a TCP 
dump to prove this, at a theoretical level isn't is possible for a NIO 
connection kept alive to be stale at the point of it being re-used?

thanks
asankha

[1] http://markmail.org/message/okuhqdcqgkavmhta

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Stale connection checking with NIO

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2013-11-19 at 15:38 +0530, Asankha C. Perera wrote:
> Hi Oleg
> > As long as the underlying channel has input interest turned on it should
> > get notified of the opposite end closing the connection. NIO connections
> > can only become 'stale' if one explicitly disables input interest prior
> > to releasing connections back to the pool
> Thank you for the reply. Input interest is turned on.. and everything 
> works fine normally. The backend is Tomcat.
> 
> However, at one of our client production sites, it seems like we 
> encounter a socket reset only after we try to write it. I am just 
> curious if anyone else has seen such an issue before. I have seen Tomcat 
> resetting newly accepted connections after ACKing [at least some of] the 
> packets when under load, but not seen resetting of a keepalive 
> connection with a TCP dump which will help us verify our hypothesis.
> 
> regards
> asankha

Asankha

I am not a TCP/IP specialist by any stretch of imagination. I really
have no idea what the cause of the problem might be. A TCP dump would be
quite useful, of course.

Sorry.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Stale connection checking with NIO

Posted by "Asankha C. Perera" <as...@apache.org>.
Hi Oleg
> As long as the underlying channel has input interest turned on it should
> get notified of the opposite end closing the connection. NIO connections
> can only become 'stale' if one explicitly disables input interest prior
> to releasing connections back to the pool
Thank you for the reply. Input interest is turned on.. and everything 
works fine normally. The backend is Tomcat.

However, at one of our client production sites, it seems like we 
encounter a socket reset only after we try to write it. I am just 
curious if anyone else has seen such an issue before. I have seen Tomcat 
resetting newly accepted connections after ACKing [at least some of] the 
packets when under load, but not seen resetting of a keepalive 
connection with a TCP dump which will help us verify our hypothesis.

regards
asankha

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Stale connection checking with NIO

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2013-11-18 at 07:42 +0530, Asankha C. Perera wrote:
> Hi Oleg
> 
> To a previous reply [1] on this list you said: "The stale connection 
> check is needed for blocking connections only as the blocking I/O model 
> provides no way of finding out whether a connection is half-closed 
> unless a attempt is made to read from the underlying socket. 
> Non-blocking connections can immediately react to I/O events due to 
> their asynchronous nature and can either be open or closed, but never 
> stale."
> 
> We are seeing something very similar to a stale connection when we try 
> to re-use a keep-alive connection. Although I still do not have a TCP 
> dump to prove this, at a theoretical level isn't is possible for a NIO 
> connection kept alive to be stale at the point of it being re-used?
> 

Hi Asankha

As long as the underlying channel has input interest turned on it should
get notified of the opposite end closing the connection. NIO connections
can only become 'stale' if one explicitly disables input interest prior
to releasing connections back to the pool.

I hope this helps

Oleg   


> thanks
> asankha
> 
> [1] http://markmail.org/message/okuhqdcqgkavmhta
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org