HttpComponentsClientHttpRequestFactory setConnectionRequestTimeout not working with httpclient 5.3.1 #34851
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: regression
A bug that is also a regression
Milestone
An example project that reproduces the issue is attached 👉 timeout.zip
Dependency versions (managed by spring-boot-starter-parent v3.3.11)
Calling the
setConnectionRequestTimeout
method does not actually apply the timeout to the request factory.Using the attached project run the following commands to reproduce the issue:
The project has
DEBUG
logs enabled for httpclient5 which will show the following:o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms o.a.h.c.h.i.classic.InternalHttpClient : ex-0000000001 preparing request execution o.a.h.c.http.impl.classic.ProtocolExec : ex-0000000001 target auth state: UNCHALLENGED o.a.h.c.http.impl.classic.ProtocolExec : ex-0000000001 proxy auth state: UNCHALLENGED o.a.h.c.http.impl.classic.ConnectExec : ex-0000000001 acquiring connection with route {s}->https://spring.io:443 -o.a.h.c.h.i.classic.InternalHttpClient : ex-0000000001 acquiring endpoint (3 MINUTES) h.i.i.PoolingHttpClientConnectionManager : ex-0000000001 endpoint lease request (3 MINUTES) [route: {s}->https://spring.io:443][total available: 0; route allocated: 0 of 5; total allocated: 0 of 25] h.i.i.PoolingHttpClientConnectionManager : ex-0000000001 endpoint leased [route: {s}->https://spring.io:443][total available: 0; route allocated: 1 of 5; total allocated: 1 of 25] h.i.i.PoolingHttpClientConnectionManager : ex-0000000001 acquired ep-0000000001 o.a.h.c.h.i.classic.InternalHttpClient : ex-0000000001 acquired endpoint ep-0000000001 o.a.h.c.http.impl.classic.ConnectExec : ex-0000000001 opening connection {s}->https://spring.io:443 o.a.h.c.h.i.classic.InternalHttpClient : ep-0000000001 connecting endpoint (null) h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 connecting endpoint to https://spring.io:443 (3 MINUTES) .i.i.DefaultHttpClientConnectionOperator : spring.io resolving remote address .i.i.DefaultHttpClientConnectionOperator : spring.io resolved to [spring.io/104.18.42.155, spring.io/172.64.145.101] .i.i.DefaultHttpClientConnectionOperator : spring.io:443 connecting null->spring.io/104.18.42.155:443 (3 MINUTES) h.i.i.DefaultManagedHttpClientConnection : http-outgoing-0 set socket timeout to 5000 MILLISECONDS .i.i.DefaultHttpClientConnectionOperator : spring.io:443 connected null->spring.io/104.18.42.155:443 as http-outgoing-0 h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 connected http-outgoing-0 o.a.h.c.h.i.classic.InternalHttpClient : ep-0000000001 endpoint connected o.a.h.c.h.impl.classic.MainClientExec : ex-0000000001 executing GET /projects/spring-framework/ HTTP/1.1 o.a.h.c.h.i.classic.InternalHttpClient : ep-0000000001 start execution ex-0000000001 h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 executing exchange ex-0000000001 over http-outgoing-0 o.a.h.c.h.impl.classic.MainClientExec : ex-0000000001 connection can be kept alive for 3 MINUTES o.a.h.c.h.i.classic.InternalHttpClient : ep-0000000001 releasing valid endpoint h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 releasing endpoint h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 connection http-outgoing-0 can be kept alive for 3 MINUTES h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 connection released [route: {s}->https://spring.io:443][total available: 1; route allocated: 1 of 5; total allocated: 1 of 25]
Updating the pom.xml in the attached example project to use spring-boot-starter-parent v3.4.5 fixes the issue and re-running the commands above will produce the expected result (as seen in the
DEBUG
logs):+o.a.h.c.h.i.classic.InternalHttpClient : ex-0000000001 acquiring endpoint (1000 MILLISECONDS)
It appears this issue was introduced by 11ebcee which closed #33806
The text was updated successfully, but these errors were encountered: