[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136670#comment-18136670
 ] 

Arturo Bernal commented on HTTPCLIENT-2437:
-------------------------------------------

Oleg, I tried the watcher thread. It does not help in this scenario.

Setup: async client 5.6.5, pool of 1 connection, connectionRequestTimeout 1 s, 
a server that never answers, request B sent while A holds the connection. B was 
still waiting after 8 s. With a thread calling closeExpired() every 200 ms the 
result is the same.

StrictConnPool#closeExpired() and LaxConnPool#closeExpired() only discard 
available entries past their expiry. validatePendingRequests() is what fails 
the pending requests, and nothing outside the pools calls it. B only failed 
when A's connection was released, and then 1.5 s late.

So the workaround in the description would not work. Do you want the docs to 
say that the timeout is only checked on pool activity, or should something call 
validatePendingRequests() periodically?

> Async connectionRequestTimeout does not fire on an otherwise idle pool
> ----------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2437
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2437
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async), Site
>    Affects Versions: 5.6.5
>            Reporter: seongsu shin
>            Priority: Major
>
> h2. Summary
> On the async client, {{connectionRequestTimeout}} does not seem to fire 
> unless something else happens in the connection pool. A request waiting for a 
> lease can wait much longer than the configured timeout.
> h2. How to reproduce
> # Set {{connectionRequestTimeout}} to 1s and limit the pool to a single 
> connection.
> # Send request A to a server that never completes the response. It holds the 
> only connection.
> # Send request B to the same route.
> h2. Observed
> Request B was still waiting after 10s.
> h2. Expected
> Request B fails with a connection request timeout after about 1s.
> h2. Analysis
> I could not find a caller of {{validatePendingRequests()}}. Pending lease 
> requests seem to be expired only when the pool is touched by other activity, 
> so an otherwise idle pool never expires them. Enforcing this may need a 
> periodic task or watcher thread, but I'm not sure whether this is intended.
> h2. Notes
> Found while writing the timeouts section for HTTPCLIENT-2404 
> (https://github.com/apache/httpcomponents-website/pull/48). Oleg Kalnichevski 
> asked there for a JIRA.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to