fix(rest): handle broken pipe gracefully#4132
Merged
GMishx merged 1 commit intoeclipse-sw360:mainfrom May 7, 2026
Merged
Conversation
Classify client-abort write failures (Broken pipe, AsyncRequestNotUsableException, ClientAbortException) separately from real serialization failures in the global exception handler. For client-abort cases, return empty 204 response and log with lower severity (WARN + DEBUG details) instead of 500 ERROR + full stacktrace. Improve transfer tolerance with: - Response compression enabled for JSON/HAL/text media types - Increased Tomcat connection timeout (60s) - Increased async request timeout (120s) Harden direct response writing in SimpleAuthenticationEntryPoint to gracefully handle client disconnects when writing unauthorized responses Add RestExceptionHandlerTest to validate client-abort vs real failure behavior. Signed-off-by: Gaurav Mishra <mishra.gaurav@siemens.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fix separates client-disconnect write failures (
Broken pipe,AsyncRequestNotUsableException) from actual serialization failures in the REST exception handler, and improves server transfer tolerance for large JSON payloads.Problem
Previously, when clients disconnected during response serialization, the server logged misleading 400/500 errors with full stacktraces as if they were application failures. This added noise to logs and masked real issues.
Solution
isClientAbortException()detector inRestExceptionHandlerto identify client-abort patterns by cause chain inspection.204 No Contentand log warning + debug details instead of attempting error body write.SimpleAuthenticationEntryPoint.commence()now gracefully handles client disconnects when writing 401 responses.Changes
HttpMessageNotWritableExceptionandAsyncRequestNotUsableException; added static client-abort detector.Testing
Run focused resource-server tests:
mvn -pl rest/resource-server -P deploy -Dbase.deploy.dir=/tmp test -DskipITsManual verification:
"Client disconnected while writing response"(WARN) instead of"Broken pipe"(ERROR with stacktrace).Checklist