Skip to content

Catch the error from a client disconnect due to stalled response#126

Merged
FranzBusch merged 2 commits intomainfrom
catch-stall
Mar 6, 2026
Merged

Catch the error from a client disconnect due to stalled response#126
FranzBusch merged 2 commits intomainfrom
catch-stall

Conversation

@xbhatnag
Copy link
Collaborator

@xbhatnag xbhatnag commented Mar 5, 2026

Motivation

PR #123 was hanging on presubmit for AHC conformance tests on Linux.

This was root-caused to an issue with testCancelPreHeaders and testCancelPreBody.

Here is the sequence of events:

  1. testCancelPreBody cancels the task making the request to /stall_body.
  2. The task cancellation causes AHC to close the connection to the server.
  3. The server then throws an error from the indefinite try await Task.sleep(..) due to client disconnection.
  4. This error propagates up from the server handler into NIOHTTPServer.
  5. Under Linux, the server is unable to handle this correctly and subsequent tests end up failing.

Note: This issue does not happen when the tests run under Mac + AHC. Further investigation into possible server-side issues is warranted here. Why does it only occur for Linux and not Mac?

Modifications

Instead of letting the error propagate up into the server, the handler swallows any errors from the /stall and /stall_body endpoints.

Result

The AHC conformance tests in #123 now pass under Linux.

Test Plan

N/A. This fixes a broken test.

@xbhatnag xbhatnag self-assigned this Mar 5, 2026
@xbhatnag xbhatnag added the 🔨 semver/patch No public API change. label Mar 5, 2026
@xbhatnag
Copy link
Collaborator Author

xbhatnag commented Mar 5, 2026

@gjcairo can you help investigate why the server behaves differently on Mac vs Linux?

@FranzBusch FranzBusch merged commit 81264a3 into main Mar 6, 2026
18 of 21 checks passed
@FranzBusch FranzBusch deleted the catch-stall branch March 6, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants