Skip to content

Remove race condition during module host exit#5573

Open
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/fix/module-host-exit
Open

Remove race condition during module host exit#5573
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/fix/module-host-exit

Conversation

@joshua-spacetime

@joshua-spacetime joshua-spacetime commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Previously exit_module_host removed a replica's HostCell before acquiring the write lock and shutting down the module/database. A concurrent access path could then create a second cell for the same replica while the old host was still exiting.

This change keeps the existing cell registered during shutdown, marks it as Exiting, and removes it from the map while still holding the write lock. Queued waiters on the old cell will then observe that it is no longer current and fail rather than initializing through stale state.

exit_module_host still returns after the provided timeout, but the shutdown task continues in the background and keeps blocking new host creation until cleanup completes.

API and ABI breaking changes

None.

Expected complexity level and risk

3

Testing

This should fix hangs/flakiness in pause/unpause and suspend/unsuspend smoketests such as unpause_makes_database_accessible_again, where a pause-triggered host exit can race with a subsequent access or relaunch.

@joshua-spacetime
joshua-spacetime force-pushed the joshua/fix/module-host-exit branch from 1c42f31 to 90e13cf Compare July 21, 2026 01:31
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