fix: Make sure an alarm can't call onStop in the middle of a start() call#218
Merged
Conversation
commit: |
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
The fix protects in-flight start() from racing with alarm()-triggered onStop by (a) deferring state.setRunning() until after container.start() and (b) only writing stopped in callOnStop if the cached state object reference hasn't been replaced. Logic looks correct. A few items to address:
- Missing changeset (high) - this is a user-facing behavior fix in
Container.start()/callOnStop. - Reference-equality invariant in
setStoppedIfUnchangedis load-bearing and undocumented (medium) - silently breaks ifContainerStateever mutatesthis.statusin place instead of reassigning. start()no longer sets state torunningwhen the container is already running (low/medium) - subtle behavior change vs. previous code; worth confirming intentional.
|
Review posted successfully on PR #218. Summary of feedback:
|
c63d3f8 to
94f4841
Compare
|
LGTM |
call We are also making sure onStop can't set 'stopped' if the method calls start().
94f4841 to
a5fd50a
Compare
|
I've already posted a thorough review on this PR (comments from LGTM |
skepticfx
approved these changes
Jun 4, 2026
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.
We are also making sure onStop can't set 'stopped' if the method calls start().