hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Gracefully handling half-closed connections (encore!)
Date Tue, 14 Apr 2009 18:35:42 GMT
Sam Crawford wrote:
> Afternoon all,
> A few months back we had an issue with handling half closed TCP connections
> with HttpClient, and at the time I was advised to include something akin to
> the IdleConnectionEvictor - which we did and it's working very nicely in
> nearly all scenarios.
> However, in the past few days we've encountered a few WebLogic based hosts
> that aren't playing fair.
> The following is one (extreme) example of the issue we're encountering:
> Time (ms)    TCP action
> 0.0000         Client > Server [SYN]
> 0.5634         Server > Client [SYN,ACK]
> 1.2092         Client > Server [ACK]          <-- TCP session established
> 312.5276         Server > Client [FIN,ACK]
> 313.1309         Client > Server [ACK]
> 401.5089         Client > Server [HTTP POST /blah]
> 403.2986         Server > Client [RST]
> In the above example, the server closes its side of the connection only
> 300ms after establishment (by sending the FIN). (As an aside I'm curious as
> to why HttpClient is taking 400ms after the TCP connection has been
> established to send the request - any suggestions are also much appreciated,
> but this doesn't happen often).

This does not sound right. The stale connection check may cause a 20 to 
30 millisecond delay (and generally should be avoided) but this is a bit 
too much. Can you produce a wire / context log of the session?

> But the above is an extreme example. We see other cases where the WebLogic
> server is closing the connection of a keep-alive connection around 10-15
> seconds after the last request.

Does the server send a 'Keep-alive' header with the response?

  Our IdleConnectionEvictor doesn't run that
> often, so we end up with unusable connections. We could just run
> IdleConnectionEvictor more often, but that's not really desirable.
> I'm going to be digging into the WebLogic side of things this afternoon (to
> see if there's any limits we can modify there), but it does seem as though
> there should be a nice way for HttpClient to detect such cases. I've got
> stale connection checking enabled already by the way.

Stale connection checking is (in most cases) evil and should be avoided.

> I'm interested in any feedback/ideas here! I can include a wire capture as
> an example if it would be helpful.

A wire / context log that correlates with the TCP dump would be great.


> Thanks again,
> Sam

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

View raw message