spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Connection close is causing premature exception: connection closed during response

Open she43 opened this issue 2 years ago • 6 comments

Describe the bug When Downstream service is sending the response header "connection" : "close", it is resulting in the below error. While the netflix zuul or non reactive spring boot applications - does not result in this. Need help in fixing this. {"status":500, "error":"Internal Server Error","message":"Connection prematurely closed DURING response","exception":"reactor.netty.http.client.PrematureCloseException","trace":"reactor.netty.http.client.PrematureCloseException: Connection prematurely closed DURING response\r\n\tSuppressed: The stacktrace has been enhanced by Reactor, refer to additional information below: \r\nError has been observed at the following site(s):\r\n\t*__checkpoint ⇢ org.springframework.web.filter.reactive.ServerHttpObservationFilter [DefaultWebFilterChain]\r\n\t*__checkpoint â

Sample

she43 avatar Oct 06 '23 15:10 she43

can someone check this ticket?

she43 avatar Oct 10 '23 08:10 she43

Is this resolved, if so how? We too are facing the same exception.

poppycoderr avatar Oct 11 '23 01:10 poppycoderr

not resolved. am waiting for an answer. thankfully - this is happening only under load and only for "GET" calls. the retry filter from spring cloud gateway does not work - since the downstream app is responding with 200 and our service is able to read it. May be some bad jackson conversion, which is causing this issue while reading the response.

For now, I have added custom retry logic in the filter which exists last and check the response is 500 and the error msg is premature close exception and the request is GET - we are trying it.

We will need a permanent fix for this.

she43 avatar Oct 12 '23 17:10 she43

thanks for your response. we are still looking for a solution.

poppycoderr avatar Oct 13 '23 01:10 poppycoderr

Any update on this?

she43 avatar Dec 15 '23 16:12 she43

any update?

she43 avatar Feb 03 '24 17:02 she43

Please describe your versions, dependencies, configuration and how to reproduce the problem.

It would be worth taking the time to provide a complete, minimal, verifiable sample (something that we can unzip attached to this issue or git clone, build, and deploy) that reproduces the problem.

spencergibb avatar Mar 12 '24 01:03 spencergibb

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Mar 19 '24 01:03 spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-cloud-issues avatar Mar 26 '24 01:03 spring-cloud-issues

@she43 Did you found any solution as i am also facing the exact same issue.

DineshKarthickRajendran avatar Jun 27 '24 00:06 DineshKarthickRajendran