Repository navigation
Conversation
chrisuthe
marked this pull request as ready for review
October 27, 2026 04:27
This was referenced Oct 27, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change addressing the audio playback startup race.
No open issues 🎉
What changed in this PR
Fixes a race in audio playback startup where a stale start acknowledgement could be cleared without notifying the main loop that the sync task is idle, leaving a pending STREAM_END blocked indefinitely.
Changes:
- Uses the pre-clear bits returned by
EventFlags::clear()to detect start acknowledgements. - Updates the inline comment to explain why the earlier flag snapshot is insufficient.
| File | Description |
|---|---|
src/sync_task.cpp |
Detects acknowledgements arriving between the flag read and clear so stale starts receive the required idle notification. |
Review effort: Balanced
kahrendt
deleted the
chrisuthe/task/split-pr-211-into-synctask-fix-winsock-init-and
branch
October 28, 2026 11:31
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.
SyncTask::wait_for_start_acknowledgement()could erase a stale start acknowledgement without noting idle for it, leaving the main loop's parkedSTREAM_ENDwaiting forever.Summary
flagsonce at the top, then clearedCOMMAND_STARTand decided whether an acknowledgement had arrived from that earlier snapshot. A stale acknowledgement (the start of a stream whose end overtook it) landing between the read and the clear was cleared but never seen, so the sync task skipped thenote_sync_idle()the main loop's heldSTREAM_ENDwaits for. Playback then deadlocked.event_flags_.clear()returns.EventFlags::clear()returns the pre-clear bits on both platforms, so whatever the clear took is what gets judged.Notes
ClientLifecycle.StreamEventsDrainedTogetherStartEachStreamOnItsOwnStart, and was split out of Fix what running on Windows turns up #211.docs/internals.md"Stream End and Start" already describes the intended behaviour (a stale acknowledgement notes idle), so it is unchanged.Testing
sendspin_tests705/705. The ASan/UBSan build could not link on this machine (no sanitizer runtime installed), so the sanitizer and TSan runs are this PR's CI.