Skip to content

HttpClientStreamableTransport#sendMessage: fix race condition on 404 response - #1306

Merged
Kehrlann merged 1 commit into
mainfrom
dgarnier/fix-flakey-tests
Nov 2, 2026
Merged

Kehrlann merged 1 commit into
mainfrom
dgarnier/fix-flakey-tests

Conversation

@Kehrlann

@Kehrlann Kehrlann commented Nov 2, 2026

Copy link
Copy Markdown
Contributor
  • There was a race condition where a 404 to a sendMessage call triggered client-side session closing. This would ultimately close open connections, including the POST for the sendMessage itself if it had not completed by then. This would cancel the Mono instead of propagating the error.
  • This was a race condition because before closing the connection, the DefaultMcpTransportSession needed to send a DELETE to the server, and waited for the response. Cancelling happened only when DELETE finished before sendMessage() finished, so it would not show often.
  • This materialized in CI as errors for test404WithSessionId.

@Kehrlann Kehrlann changed the title HttpClientStreamableTransport: fix race condition on 404 response HttpClientStreamableTransport#sendMessage: fix race condition on 404 response Nov 2, 2026
@Kehrlann
Kehrlann force-pushed the dgarnier/fix-flakey-tests branch from 4d9e11b to 600c377 Compare November 2, 2026 14:59
- There was a race condition where a 404 to a sendMessage call triggered
  client-side session closing. This would ultimately close the reactive
  chain representing HTTP connections, including the POST for the
  sendMessage itself if it had not completed by then. This would cancel
  the Mono instead of propagating the error.
- This was a race condition because before closing the connection, the
  DefaultMcpTransportSession needed to send a DELETE to the server, and
  waited for the response. Cancelling happened only when DELETE finished
  before sendMessage() finished, so it would not show often.
- This materialized in CI as errors for `test404WithSessionId`.

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
@Kehrlann
Kehrlann force-pushed the dgarnier/fix-flakey-tests branch from 600c377 to 235f6bd Compare November 2, 2026 17:42
@Kehrlann
Kehrlann merged commit 664e6f5 into main Nov 2, 2026
25 checks passed
@Kehrlann
Kehrlann deleted the dgarnier/fix-flakey-tests branch November 2, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant