Skip to content

Avoid draining failed streaming proxy responses#4217

Open
goutamadwant wants to merge 1 commit into
spring-cloud:mainfrom
goutamadwant:GH-3999
Open

Avoid draining failed streaming proxy responses#4217
goutamadwant wants to merge 1 commit into
spring-cloud:mainfrom
goutamadwant:GH-3999

Conversation

@goutamadwant

Copy link
Copy Markdown

Fixes gh-3999

This PR updates MVC proxy response cleanup so streaming response copy failures close the active response body stream directly instead of calling ClientHttpResponse.close(). Some ClientHttpResponse implementations drain remaining content during close(), which can hang for long-lived SSE responses after the downstream client disconnects.

Normal completion and non-streaming error cleanup still use ClientHttpResponse.close().

Tests:

  • ./mvnw -pl spring-cloud-gateway-server-webmvc -Dtest=RestClientProxyExchangeTests test
  • ./mvnw -pl spring-cloud-gateway-server-webmvc -Dtest=RestClientProxyExchangeTests,AbstractProxyExchangeTests,ProxyExchangeHandlerFunctionTest test

Fixes spring-cloudgh-3999

Signed-off-by: goutamadwant <workwithgoutam@gmail.com>
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.

Spring Cloud Gateway MVC leaks connection using Server-Sent-Events

2 participants