Repository navigation
fix: Serialise Crow's Server::stop() on SIGTERM (#249) - #250
Merged
Merged
Conversation
…threads (#249) - The stop poll in APIServer::run called app.stop() without stop_mutex_; APIServer::stop() sets stop_requested_ first and calls app.stop() under it, so both could run Crow's non-thread-safe Server::stop() at once - Seen as SIGSEGV with an MCP task in flight on main's CI (3d20f55); the log closed the same acceptor twice - try_lock in the poll: while stop() holds the lock it issues app.stop() itself, and the next tick retries, so a stop during startup still takes effect - Shutdown tests assert the acceptor is closed exactly once - Closes #249
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
APIServer::runcalledapp.stop()withoutstop_mutex_, racingAPIServer::stop()'s own call: two threads in Crow's non-thread-safeServer::stop(). Main's CI on the release commit 3d20f55 died with SIGSEGV this way (acceptor closed twice in the log).try_lockonstop_mutex_; the startup-window guarantee (a stop before Crow publishes its server still takes effect) is unchanged.Test plan
The race is timing-dependent (0 in 200 local runs before the fix), so there is no deterministic red; the new assertion catches it whenever it fires.
Closes #249
🤖 Generated with Claude Code
https://claude.ai/code/session_018txuxF9jXyiKakpUoXrKBi
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.