Skip to content

Fix client disconnect logged as error in WebFlux#36822

Closed
suuuuuuminnnnnn wants to merge 1 commit into
spring-projects:mainfrom
suuuuuuminnnnnn:fix/gh-36811-client-abort-logging
Closed

Fix client disconnect logged as error in WebFlux#36822
suuuuuuminnnnnn wants to merge 1 commit into
spring-projects:mainfrom
suuuuuuminnnnnn:fix/gh-36811-client-abort-logging

Conversation

@suuuuuuminnnnnn
Copy link
Copy Markdown

In HttpWebHandlerAdapter.handleUnresolvedError(), when a client
disconnects before the response is committed (e.g., the client
sends a partial request body and closes the connection), the
resulting AbortedException arrives while setStatusCode(500)
still returns true. This causes the handler to immediately log
a 500 Server Error at ERROR level and return, making the
checkAndLogClientDisconnectedException branch unreachable.

This commit moves the disconnect check before the 500 status
assignment. DisconnectedClientHelper.isClientDisconnectedException
already excludes outbound/remote-call exception wrappers, so the
reordering does not affect server-side error handling.

Closes gh-36811

In HttpWebHandlerAdapter.handleUnresolvedError(), when a client
disconnects before the response is committed, setStatusCode(500)
succeeds and logs a 500 Server Error at ERROR level. The
checkAndLogClientDisconnectedException check was never reached.

Move the disconnect check before the 500 status assignment.
DisconnectedClientHelper already excludes remote-call wrappers
so the reordering does not affect server-side error handling.

Closes spring-projectsgh-36811

Signed-off-by: suuuuuuminnnnnn <sumin45402214@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 21, 2026
@rstoyanchev
Copy link
Copy Markdown
Contributor

Thanks for the suggestion, but the fix is not as obvious as it seems, and also required deeper review.

@rstoyanchev rstoyanchev closed this Jun 1, 2026
@rstoyanchev rstoyanchev added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AbortedException from client logged at ERROR level with WebFlux functional endpoint

3 participants