Skip to content
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

Fix PrematureCloseException by adding check for connection and channel before dispose #2093

Closed
wants to merge 1 commit into from

Conversation

AsCat
Copy link
Contributor

@AsCat AsCat commented Dec 29, 2020

Add channel check before dispose which may cause reactor-netty PrematureCloseException.

Test case:
1、We are doing a perfomance test using Spring Cloud Gateway v2.2.5.RELEASE
2、The request is HTTP POST which body size is less than 1k Bytes
3、The backend service return a response 200 OK as a result

Bug description:
Exception appears in spring cloud gateway in Very Small Probability as below:
reactor.netty.http.client.PrematureCloseException: Connection has been closed BEFORE response, while sending request body

In nearly 500,000 http post request tests, there will be dozens of errors.

When applied this fix, retested with nearly 3, 000,000 requests, No error occurred.

Related issue:

SCG:
Connection prematurely closed BEFORE response

Copy link
Contributor

@ctlove0523 ctlove0523 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test this PR and it works well

@spencergibb spencergibb linked an issue Jan 11, 2021 that may be closed by this pull request
@spencergibb spencergibb self-assigned this Jan 11, 2021
@spencergibb
Copy link
Member

@violetagg, @bsideup or @OlegDokuka do you see any issues with this?

@OlegDokuka
Copy link

LGTM. But better to ask @violetagg

@violetagg
Copy link
Contributor

LGTM

@kanai0618
Copy link

kanai0618 commented Jan 19, 2021

Hi @spencergibb @OlegDokuka in zuul we have zuul.host.socket-timeout-millis, do we have any equivalent in spring cloud gateway ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection prematurely closed BEFORE response
7 participants