-
Notifications
You must be signed in to change notification settings - Fork 13
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
Upgrade to 4.0.2 causes timeouts in Spring Framework's WebClient #354
Comments
@poutsma I cannot build the branch because:
Apparently |
@sbordet how did you end up with that issue? We don't have any reference to |
@snicoll I don't recall how I suspect the internal wiring performed by Spring is not 100% correct. With Jetty RHC 4.0.2 we are more lenient for double subscriptions, but I can see that the second subscription happens in the context of the call to I suspect it is not intended to subscribe twice to the response content because the second subscription will be pointless as in many cases the response content is not reproducible: it should be read only once. The Jetty RHC reports a complete event after the response content has been read. This event is clearly reported to Spring, to the Flux created here: JettyClientHttpConnector.java:137. I suspect that Flux is subscribed multiple times, but it is the second subscriber that would make things work; however the notification is sent to the first subscriber. If I manually modify the code during debugging, so that an exception is thrown when the second subscription happens, the test passes 😄 Would you mind to have a look at why Spring subscribes twice? My guess is that fixing that would fix the JDK client (that now works only because it throws an Thanks! |
Thanks for the feedback, @sbordet. I will investigate, and get back to you. |
Thanks for the pointers, @sbordet. After making sure that response bodies can only be subscribed to once, we no longer see the timeouts we saw before. Closing this issue. |
Upgrading to jetty-reactive-httpclient:4.0.2 causes timeouts in Spring Framework's
WebClient
when using Jetty's Reactive HTTP Client. We believe that this might be caused by the changes done as part of #323 or #194.To reproduce the timeouts, use this branch of Spring framework: https://github.com/poutsma/spring-framework/tree/gh-31931 (the main branch is kept on 4.0.1 until this is resolved), and run the
org.springframework.web.reactive.function.client.WebClientIntegrationTests
in thespring-webflux
module. All tests in this class result in timeouts when usingJettyClientHttpConnector
, while other connectors (Reactor Netty, JDK HttpClient, Apache HTTP Components) run fine.Note that the
WebClientIntegrationTests
do not connect to a "real" web server, but useMockWebServer
from OkHttp 3 instead. Using the WebClient with theJettyClientHttpConnector
to connect to a real host, such as http://example.com, seems to work fine. So this could very well be an issue inMockWebServer
, if it wasn't for the fact that other connectors work fine, and that we have not made any recent changes in the code that uses the Jetty's reactive HTTP client.Additionally, it could very well be that we are using Jetty's reactive HTTP client in an incorrect manner. If so, please suggest any changes we can make. All relevant code is in
JettyClientHttpConnector
,JettyClientHttpRequest
andJettyClientHttpResponse
in theorg.springframework.http.client.reactive
package of the spring-webflux module.The text was updated successfully, but these errors were encountered: