Skip to content

fix: route session/update racing with a reaped holder to the global handler (IJAI-2705) - #145

Merged
EugeneTheDev merged 1 commit into
masterfrom
eugenethedev/fix-session-race
Oct 15, 2026
Merged

EugeneTheDev merged 1 commit into
masterfrom
eugenethedev/fix-session-race

Conversation

@EugeneTheDev

@EugeneTheDev EugeneTheDev commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • A session/update can find a speculative session holder just before withInitializingSession reaps it, then queue into it afterwards. handleOrQueue awaited the failed session and threw AcpExpectedError: Session … not found, which Protocol logged at SEVERE.
  • handleOrQueue now reports such an update as undelivered, and the handler sends it to globalSessionUpdateHandler (or drops it at debug level).
  • failAndDrainQueue closes the channel before draining, so an update can't be queued after the drain and lost. The holder fails only after the drain, so late updates come after the queued ones.
  • ClientSessionHolder moved to its own internal class to be testable. No public API change.

Tests

  • ClientSessionHolderTest drives both states deterministically with runTest. Both tests fail on the old code with the ticket's error.

YouTrack: IJAI-2705

@EugeneTheDev
EugeneTheDev requested a review from Rizzen October 15, 2026 10:35
@EugeneTheDev
EugeneTheDev merged commit 0bbffa5 into master Oct 15, 2026
2 checks passed
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.

2 participants