-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Do not emit a redundant ready event during initialization #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
8e9510c
test: Wait for the ready event instead of asserting immediately
devin-ai-integration[bot] 5a71aea
chore: trigger CI (1)
devin-ai-integration[bot] 69cd472
chore: trigger CI (2)
devin-ai-integration[bot] 89fc654
chore: trigger CI (3)
devin-ai-integration[bot] 9d4f262
chore: trigger CI (4)
devin-ai-integration[bot] d0dfcc2
chore: trigger CI (5)
devin-ai-integration[bot] 3ea239a
chore: trigger CI (6)
devin-ai-integration[bot] 2778752
chore: trigger CI (7)
devin-ai-integration[bot] b8b696b
chore: trigger CI (8)
devin-ai-integration[bot] a1ab6ea
chore: trigger CI (9)
devin-ai-integration[bot] 53c302f
chore: trigger CI (10)
devin-ai-integration[bot] cfa33ad
fix: Do not emit a redundant ready event during initialization
devin-ai-integration[bot] dde5812
chore: trigger CI (11)
devin-ai-integration[bot] f71563d
chore: trigger CI (12)
devin-ai-integration[bot] c3babcb
chore: trigger CI (13)
devin-ai-integration[bot] ae0d4e9
chore: trigger CI (14)
devin-ai-integration[bot] f41022d
chore: trigger CI (15)
devin-ai-integration[bot] e22c8b0
chore: trigger CI (16)
devin-ai-integration[bot] 1d550f7
chore: trigger CI (17)
devin-ai-integration[bot] 7559160
chore: trigger CI (18)
devin-ai-integration[bot] 7e68dee
chore: trigger CI (19)
devin-ai-integration[bot] 07e7993
chore: trigger CI (20)
devin-ai-integration[bot] 811ad90
test: Cover ready events after a failed initialization
devin-ai-integration[bot] 25e1801
chore: trigger CI (21)
devin-ai-integration[bot] 2ded1db
chore: trigger CI (22)
devin-ai-integration[bot] e21ff22
chore: trigger CI (23)
devin-ai-integration[bot] 3b811ed
chore: trigger CI (24)
devin-ai-integration[bot] e969437
chore: trigger CI (25)
devin-ai-integration[bot] bc6a773
chore: trigger CI (26)
devin-ai-integration[bot] 1e7971d
chore: trigger CI (27)
devin-ai-integration[bot] aacfd26
chore: trigger CI (28)
devin-ai-integration[bot] 5deabef
chore: trigger CI (29)
devin-ai-integration[bot] 9220377
chore: trigger CI (30)
devin-ai-integration[bot] f8a6052
refactor: Read the initializing flag under the state lock
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a volatile handle all ordering concerns that may apply in this situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — a bare
volatilewas not enough. It gave visibility for the flag itself, but the decision "did this VALID transition happen duringinitialize?" involves two pieces of state (initializingandstate), and reading them at different times leaves a window: the flag could be cleared between thesynchronized (stateLock)block that claims the ready transition and the read ofinitializingjust after it, so the initial ready event could be emitted twice.Latest commit makes the pair atomic instead:
initializingis now a plain field always accessed understateLock, and the "should we emit?" decision is made inside the same critical section that transitionsstatetoREADY.initializewrites the flag throughsetInitializing, which takes the same lock, so the flag write and the state read can't interleave.Stress run after the change: 25/25 green under CPU load (6 busy loops).