Hi Mark,
Got it. >You have just described a race condition. The fix is to ensure that unused >connections in the client pool timeout faster than Tomcat's keep-alive timeout. Thanks for your explanation and solution! Best Regards Hailei Zhang At 2012-08-30 15:52:09,"Mark Thomas" <ma...@apache.org> wrote: >zhh5919 <zhh5...@163.com> wrote: > >>When HttpClient borrow a connection from ConnectionManager and write >>something to this conneciton. In the meanwhile tomcat pepare to close >>this connection due to keepalive timeout,so it don't read from this >>connection and just close it. > >You have just described a race condition. The fix is to ensure that unused >connections in the client pool timeout faster than Tomcat's keep-alive timeout. > >>I read NioEndpoint code and find that process time-out after process >>selected keys. >>Timeout need proccess all key rather than selected keys.During process >>timeout,if one socket(channel) receive some data,it will do nothing and >>just close it.so the client peer will throw connectionresetException. >>Could you please tell me my analysis is correct? > >No it is not correct. There will always be a point after Tomcat decides to >close the connection where the client may send more data before the connection >close is complete. That is why you need to make sure it is the client that >closes the connection first. > >> I apologize for my poor English. > >No need to apologise. It was very easy to understand your email. > >Kind regards, > >Mark > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >For additional commands, e-mail: users-h...@tomcat.apache.org >