Skip to content

fix: release playback waiter when the audio stream dies (#522) - #523

Open
moabian wants to merge 1 commit into
mbailey:masterfrom
moabian:patch-1
Open

moabian wants to merge 1 commit into
mbailey:masterfrom
moabian:patch-1

Conversation

@moabian

@moabian moabian commented Aug 18, 2026

Copy link
Copy Markdown

Full analysis, reproduction and evidence in #522.

playback_complete was only ever set from inside _audio_callback. When a stream dies abnormally - e.g. a concurrent client invalidating it (PaErrorCode -9988) - the callback stops being invoked, nothing sets the event, and _wait_for_player_with_control() awaits forever. converse() never returns, its finally never runs, and the conch is held indefinitely.

finished_callback fires whenever PortAudio tears the stream down for any reason, so the waiter is always released.

Tested on 8.12.0 (WSL2/WSLg): normal playback unaffected on both the local CLI and streamable-HTTP paths.

playback_complete was only ever set from inside _audio_callback. When a stream
dies abnormally - e.g. a concurrent client invalidating it (PaErrorCode -9988) -
the callback stops being invoked, nothing sets the event, and
_wait_for_player_with_control() awaits forever. converse() never returns, its
finally never runs, and the conch is held indefinitely.

finished_callback fires whenever PortAudio tears the stream down for any reason,
so the waiter is always released.

Tested on 8.12.0 (WSL2/WSLg): normal playback unaffected on both the local CLI
and streamable-HTTP paths.
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