In section 2.5. Connection eviction policy
of the documentation
connection managment doc for httpclient
mentions that
HttpClient tries to mitigate the problem by testing whether the connection is 'stale', that is no longer valid because it was closed on the server side, prior to using the connection for executing an HTTP request. The stale connection check is not 100% reliable.
I am just wondering why stale connection cant be checked reliably ? What logical/TCP construct dont allow it to happen reliably?
It is trivial. There is always a window of time, however small, between the successful stale check and request execution, in which the opposite endpoint can close the connection on its end and make the connection stale on the client end.