Kristijan Postolov created HTTPCLIENT-2298:
----------------------------------------------

             Summary: Requests reported as pending longer than expected
                 Key: HTTPCLIENT-2298
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2298
             Project: HttpComponents HttpClient
          Issue Type: Bug
    Affects Versions: 5.2.1
            Reporter: Kristijan Postolov


I was upgrading to the new httpclient5 (more specifically 5.2.1) and noticed an 
issue where the StrictConnPool does not return accurate stats for the number of 
pending request.

 

I created an httpClient with connectionRequestTimeout=2000 (2 seconds), 
responseTimeout=12000 (12s) and maxConnTotal=1 on the 
poolingHttpClientConnectionManager.

The connection request timeout works as expected, when I make a slow request 
that runs for 10 seconds, and in the meantime I start a second one, the second 
request will fail after 2 seconds, as there is no available connection.

 

However, after the 2 seconds, when the second connection throws a timeout 
exception I check the 
poolingHttpClientConnectionManager.getTotalStats().getPending(),

I am still receiving 1 (meaning there is one request that is waiting for a free 
connection), even though this is not true since the request timed out after the 
configured 2 seconds.

This number gets back to 0, only when the first connection is released (the 
first 10 second request finishes). I checked the same behavior with the old 
client (httpclient 4.5.14) and there the pending requests was decremented right 
after the connection request timeout is reached.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to