Skip to content

fix(web): handle HttpMessageNotWritableException in DisconnectedClien…#36615

Open
dahyvuun wants to merge 1 commit intospring-projects:mainfrom
dahyvuun:fix/disconnected-client-http-message-not-writable
Open

fix(web): handle HttpMessageNotWritableException in DisconnectedClien…#36615
dahyvuun wants to merge 1 commit intospring-projects:mainfrom
dahyvuun:fix/disconnected-client-http-message-not-writable

Conversation

@dahyvuun
Copy link
Copy Markdown

@dahyvuun dahyvuun commented Apr 7, 2026

Problem

When a client disconnects, @ExceptionHandler attempts to write a response, resulting in HttpMessageNotWritableException wrapping an IOException: The response may not be written to once it has been closed. This exception is not recognized by DisconnectedClientHelper and propagates to the Servlet container unnecessarily.

Solution

Add "response may not be written" to the EXCEPTION_PHRASES set in DisconnectedClientHelper so that this scenario is silently logged at DEBUG level instead of propagating.

Closes #36421

@dahyvuun dahyvuun force-pushed the fix/disconnected-client-http-message-not-writable branch from e0e0343 to 3a00365 Compare April 7, 2026 18:14
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 7, 2026
@dahyvuun dahyvuun force-pushed the fix/disconnected-client-http-message-not-writable branch from 3a00365 to dcb1920 Compare April 7, 2026 18:18
…tHelper

Signed-off-by: dahyvuun <dahyvuun@gmail.com>
@dahyvuun dahyvuun force-pushed the fix/disconnected-client-http-message-not-writable branch from dcb1920 to 4fc38d4 Compare April 7, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure in @ExceptionHandler from IOException: The response may not be written to once it has been closed

2 participants