HttpComponentsClientHttpConnector hangs when host is invalid #29156
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Hi,
today we spent quite a bit of time debugging a hang in the
WebClient
in combination with using Apache'sHttpComponentsClientHttpConnector
that essentially boils down to the following:(I've put this also into an example under https://github.com/dreis2211/spring-httpclient-hang-demo for simpler reproduction)
It seems that the empty or nulled
baseUrl
should lead to an exception like the following, but the exception seems to be swallowed and the client request hangs afterwards.It might be very well a problem of Apache's HttpClient, but a quick look at https://github.com/apache/httpcomponents-client/blob/5.1.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchange.java#L67 and commenting the line leads to the expected exception and no hang.
Unfortunately, my investigation time is limited and I hope you can take over from here.
The issue is obviously a misconfiguration of the WebClient in our particular case (and already fixed), but the hang is somewhat unexpected and dangerous. Especially if timeouts are configured one expects no infinite blocking.
Let me know if you need anything.
Cheers,
Christoph
The text was updated successfully, but these errors were encountered: