On 30/10/2024 07:45, Stankov. Yavor wrote:
Hi,
I'm using:
HTTP Client 5 v5.3.1
HTTP Components Core 5 v5.2
Java 17
I got the following exception during HTTP Client execution:
Caused by: org.apache.hc.core5.http.ConnectionRequestTimeoutException: Timeout
deadline: 10000 MILLISECONDS, actual: 10000 MILLISECONDS
at
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:120)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:125)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
~[?:?]
at
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:87)
~[?:?]
I'm trying to understand what exactly this timeout means.
It basically means that HttpClient gave up waiting for a connection in
the connection pool to become available
What can cause it?
The pool has not been properly sized, but more likely your code is
leaking connections
Is it a timeout while waiting for connection or is it like a read time out?
It is the former.
It disappeared after a restart of the application.
1. Make sure your code is not using deprecated HttpClient APIs.
2. Favor HttpClient#execute methods that handle connection release
automatically for you
3. Run your code with connection management logging turned on as
described here to find out where exactly connections are being leaked.
https://hc.apache.org/httpcomponents-client-5.4.x/logging.html
See `Enable context logging for connection management / request execution`
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org