spring-cloud / spring-cloud/spring-cloud-gateway
Ignore ReadTimeoutException | PrematureCloseException but ServerHttpResponse already committed (200 OK)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Hello, I get such errors
{{ [f52d6df0-189875] Error [io.netty.handler.timeout.ReadTimeoutException] for HTTP GET "/**/sse", but ServerHttpResponse already committed (200 OK)}}
[7d60483e-178] Error [reactor.netty.http.client.PrematureCloseException: Connection prematurely closed DURING response] for HTTP POST "/**/request", but ServerHttpResponse already committed (200 OK)
when making requests, I would like to ignore them, but I can't figure out how to implement this through a stub in tests, maybe this can't be done through WebTestClient. Can we do it this way?
ServerHttpResponse response = request.exchange().getResponse();
if (error instanceof PrematureCloseException || error instanceof ReadTimeoutException) {
if (response.isCommitted()) {
HttpStatus status = response.getStatusCode();
if (status != null && status.is2xxSuccessful()) {
log.debug("Client disconnected after 2xx response was committed: {}", error.toString());
return Mono.empty();
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WebTestClient request and ServerHttpResponse handling shown in the issue, then trace where ReadTimeoutException and PrematureCloseException are handled after a 2xx response is committed. Reproduce the SSE or POST scenario and determine whether a test can verify that these client-disconnect errors are ignored only after a committed successful response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100