Skip to content

test: Add regression test for stopping a stream with a failing callback. - #858

Merged
kinetiknz merged 1 commit into
masterfrom
test-stop-with-erroring-callback
Aug 26, 2026
Merged

kinetiknz merged 1 commit into
masterfrom
test-stop-with-erroring-callback

Conversation

@kinetiknz

Copy link
Copy Markdown
Collaborator

Returning an error from the data callback makes AAudio stop the stream itself, from the callback thread, before the stream has been reported as started. The stream goes STARTING -> STOPPED without ever passing through STARTED, and a backend waiting for one specific state rather than for any settled state waits forever, taking cubeb_stream_stop() down with it. This is the hang fixed in 92ab428.

The failure mode is a hang rather than a wrong result, so the calls under test run on a separate thread and the test fails if they do not return within 30s, leaking the context rather than tearing it down underneath a thread still stuck inside cubeb. Return codes are not checked: a stream whose callback has already errored out may legitimately refuse to start or stop, so what is asserted is only that these entry points return at all.

Against the parent of 92ab428 this fails 5/5 on the aaudio backend, and the rest of test_sanity still runs to completion.

Returning an error from the data callback makes AAudio stop the stream
itself, from the callback thread, before the stream has been reported as
started. The stream goes STARTING -> STOPPED without ever passing
through STARTED, and a backend waiting for one specific state rather
than for any settled state waits forever, taking cubeb_stream_stop()
down with it. This is the hang fixed in 92ab428.

The failure mode is a hang rather than a wrong result, so the calls
under test run on a separate thread and the test fails if they do not
return within 30s, leaking the context rather than tearing it down
underneath a thread still stuck inside cubeb. Return codes are not
checked: a stream whose callback has already errored out may
legitimately refuse to start or stop, so what is asserted is only that
these entry points return at all.

Against the parent of 92ab428 this fails 5/5 on the aaudio backend, and
the rest of test_sanity still runs to completion.
@kinetiknz kinetiknz self-assigned this Aug 26, 2026
@kinetiknz
kinetiknz merged commit 0ef8af5 into master Aug 26, 2026
15 checks passed
@kinetiknz
kinetiknz deleted the test-stop-with-erroring-callback branch August 26, 2026 22:08
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