-
Notifications
You must be signed in to change notification settings - Fork 633
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
Got Connection prematurely closed BEFORE response #796
Comments
Added full error log with |
this will help |
@harish0000 As I wrote here spring-projects/spring-framework#22464 (comment) |
@thsnoopy Thanks for the reproducible scenario. We are working on a fix. |
@violetagg Thank you for investigating. |
@thsnoopy just a quick heads up - we root caused the issue to two things :
We are going to change the default connection pool for our clients in 0.9, and document how to set those up. What happens right now is there is no limit, so you are opening 80000 connections to a single destination, thats more than ephemeral ports and thats overall a lot of pending events that could be delayed and cause a connect timeout. Usually, connection pools are capped by default, e.g. Golang has 100 (including only "2" by destination), other libraries run 64, 100 or again 2-6 (the RFC recommendation for browsers). We should limit the number of open connections too by default and we benchmarked with So i'm leaving the issue open until we change that default and document it overall but you should try as a workaround to set your client this way:
|
For reference #578 |
@smaldini I have one more question. Is this symptom also happen with |
I tried out the code sample posted by @thsnoopy --- using the latest reactor netty and the spring reactor netty started 2.2.4 -- but the issue still persists... it is using netty 4.1.45.Final and still seeing the premature connection issue. |
I have the same error:
spring version: |
@YuryYaroshevich If you have a reproducible example, please create a new issue with it. |
@violetagg I have an application which sends dozens of requests here there and I see this error without any correlation with request type or 3rd party service. What example can I create? Could you please give me some clue on what can cause an error with such message? |
@YuryYaroshevich this issue here was related to the |
I get same error when using the WebClient to POST something in parallel(I am using spring-boot-starter-webflux:jar:2.2.4(which comes with the reactor-netty:jar:0.9.4.RELEASE). the webclient is in an async executer. |
@sanjosva Please create a new issue with a reproducible example against the latest released version. |
@saralpa This issue's been closed already, create a new issue and provide tcp dump so that we can see which peer closes the connection. |
@violetagg any other issue opened for this?. |
@nitinkalenk please open new issue |
I have the same issue with netty 4.1.69 and reactore 1.0.12 |
@FARHANE This issue has been closed already. Please create a new issue with a reproducible example and there we will investigate your particular use case. |
@FARHANE were you able to fix the issue? |
@niklaspeura You should open a new issue with a reproducible example. There we will track your particular problem. This issue has been closed already. |
Any way to fix it or any notices? i'm having the same problem. This occurs many and unexpected times, and i cannot reproduce the scenario in my localhost. |
Same problem, occurs with 2/20 http requests and only in production, I cannot reproduce in my localhost too. Load Balancer can influence something? |
@GabrielC10 Have you found the solution? Which cloud provider do you use? |
Thanks, I saw it @violetagg |
@y0zg I haven't found a solution, but, without a Load Balancer target this problem does happen |
Expected behavior
When using the WebClient to
POST
something in parallel, I should be getting successful results.Actual behavior
Intermittently, I got an error with
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
. In my experience, it arises with 20 percent probability.Steps to reproduce
I googled and searched related issue and they say it may be resolved in latest reactor-netty version. But unfortunately, even if I use the latest spring-boot & reactor-netty version I got a similar issue.
I also read recently registered issue #774 , and it requires more reproducible information like logging and wiretap.
So, I've made a reproducible demonstration: https://github.com/thsnoopy/reactor-netty-report .
(It is configured with
logging.level.reactor.netty=debug
andhttpServer.wiretap
)The demonstration is composed of three apps :
POST
API endpointPOST
API usingWebClient
client-actor
communicates withserver-actor
test-runner
--(GET)-->client-actor
--(POST)-->server-actor
I hope it will help you for debugging :)
You can check out and run
./runTest.sh
and see the log file inclient-actor/log/server-actor-***.log
. In my experience, the test failed with 20 percent probability.And one more, if you run the test after restarting the server(
server-actor
andclient-actor
), you will get an error with a higher probability(runTest.sh
script already involve this).Reactor Netty version
JVM version (e.g.
java -version
)OS version (e.g.
uname -a
)Darwin name 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64 (
macOS Mojave 10.14.2
)The text was updated successfully, but these errors were encountered: