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

Kristijan Postolov commented on HTTPCLIENT-2298:
------------------------------------------------

Hi [~olegk],

Thanks for checking this, I completely understand that the issue has low impact 
since its not affecting the client functionality, but rather the client 
statistics. We only noticed it because we have some metrics on top of these 
stats. I am attaching the stack trace of the connection timeout.

Best,
Kristijan

org.apache.hc.core5.http.ConnectionRequestTimeoutException: Timeout deadline: 
2000 MILLISECONDS, actual: 2007 MILLISECONDS
    at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:120)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:125)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:106)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:55)
 ~[httpclient5-5.2.1.jar:5.2.1]
    at 
org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:93)
 ~[spring-web-6.0.11.jar:6.0.11]
    at 
org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
 ~[spring-web-6.0.11.jar:6.0.11]
    at 
org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66)
 ~[spring-web-6.0.11.jar:6.0.11]
    at 
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:862) 
~[spring-web-6.0.11.jar:6.0.11]
    at 
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:764) 
~[spring-web-6.0.11.jar:6.0.11]
    at 
org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:378) 
~[spring-web-6.0.11.jar:6.0.11]
    at com.example.democlient.ClientController.client(ClientController.java:55) 
~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method) ~[na:na]
    at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
 ~[na:na]
    at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:na]

> 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
>            Priority: Minor
>
> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to