Skip to content

SBP-2: run session bus reset outside the registry lock - #229

Merged
mrmidi merged 1 commit into
mrmidi:mainfrom
mhellevang:fix/sbp2-bus-reset-outside-lock
Oct 23, 2026
Merged

mrmidi merged 1 commit into
mrmidi:mainfrom
mhellevang:fix/sbp2-bus-reset-outside-lock

Conversation

@mhellevang

@mhellevang mhellevang commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to the review comment on #227, which got merged before the fix landed.

OnBusReset called HandleBusReset with the registry's lock_ held. The session's executor lets the calling thread run work that other threads queue meanwhile (a client's Logout(), also Login() or AbandonSuspended()). When that work fires a callback, the callback takes lock_ again on the same thread.

Fix as suggested: copy the sessions out under the lock, keep executor->OnBusReset() and the retiring-entry cleanup under it, and call HandleBusReset after releasing it.

Test: SessionRegistryTests.BusResetRunsSessionWorkOutsideRegistryLock. A login is in flight; when the reset cancels its timeout, another thread queues work on the session (new one-shot onNextCancel hook in FakeSessionScheduler). Before the fix it aborts on the recursive IOLockLock.

Host suite green.

@mrmidi
mrmidi merged commit 0a3879e into mrmidi:main Oct 23, 2026
2 checks passed
@mhellevang
mhellevang deleted the fix/sbp2-bus-reset-outside-lock branch October 23, 2026 19:27
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