-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify ClientHttpRequestInterceptor#intercept()
must close response if it throws exception after receiving the response
#29751
Comments
PoolingHttpClientConnectionManager
connection leaks in case exception thrown during execution of ClientHttpRequestInterceptor#intercept()
@frederic-boissiere thanks for the sample but running the main invokes your custom code ten times and then exit. What part specifically is showcasing the connection leak? |
Hello @snicoll, |
Normally, the response would be closed (and connection released) in |
Hello @rstoyanchev, from my point of view, this information is missing from the javadoc. |
Fair enough, I'll update the Javadoc. |
By the way, looking at the custom |
PoolingHttpClientConnectionManager
connection leaks in case exception thrown during execution of ClientHttpRequestInterceptor#intercept()
ClientHttpRequestInterceptor#intercept()
must close response if it throws exception after receiving the response
Affects: Spring Framework 5.3.22
Hello, our application implements a custom
RestTemplate
usingorg.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager
.Moreover, a custom
ClientHttpRequestInterceptor
is added to thisRestTemplate
.In case an exception is raised during the execution of the
ClientHttpRequestInterceptor#intercept()
method then the connection stays in leased state, and it is never released leading to "Timeout waiting for connection from pool" exception.In attachment a simple sample reproducing this behavior: connpool.zip
The text was updated successfully, but these errors were encountered: