'Why the stale connection check is not 100% reliable in apache httpclient connectionPool

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MatPag