spring-projects / spring-projects/spring-ai
Bug: Race condition in WebClientStreamableHttpTransportErrorHandlingIT.testSessionRecoveryAfter404
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Problem
The testSessionRecoveryAfter404 test has a race condition where an assertion runs before the previous async HTTP request completes, causing intermittent CI/CD failures.
Root Cause
Missing synchronization between async operations in the test's Mono chain. The test was asserting that a session ID was cleared before the HTTP request that invalidated the session had actually completed.
Solution
Add a 200ms delay between session loss handling and subsequent assertions to ensure proper async coordination (similar to existing pattern in test404WithSessionId).
Impact
This race condition has been causing intermittent CI/CD failures in the WebFlux transport integration tests.
Related PR
PR: feature/fix-mcp-transport-race-condition (galt-k fork)
Commit: be06d3d - "Fix race condition in MCP WebFlux transport error handling test"
Test Results
All 6 tests in WebClientStreamableHttpTransportErrorHandlingIT now pass consistently:
- test404WithoutSessionId ✓
- test404WithSessionId ✓
- test400WithoutSessionId ✓
- test400WithSessionId ✓
- testSessionRecoveryAfter404 ✓
- testReconnectErrorHandling ✓
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with WebClientStreamableHttpTransportErrorHandlingIT.testSessionRecoveryAfter404 and compare its Mono chain with test404WithSessionId. Run the six named integration tests and confirm the recovery assertion consistently occurs after the async request completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100