Skip to content

[test only] session-description-handler.spec.ts: Fix flaky NotReadableError - #4

Draft
23Skidoo wants to merge 1 commit into
yay-com:mainfrom
23Skidoo:fake-device-keepalive
Draft

23Skidoo wants to merge 1 commit into
yay-com:mainfrom
23Skidoo:fake-device-keepalive

Conversation

@23Skidoo

@23Skidoo 23Skidoo commented Aug 26, 2026

Copy link
Copy Markdown

The Web SessionDescriptionHandler interop specs fail intermittently with NotReadableError: Could not start audio source, landing on a different spec each time and more often on loaded machines.

Chrome coalesces getUserMedia calls for one device onto a shared device session. Every spec boundary in this file stops all tracks, dropping the session's consumer count to zero and starting an asynchronous teardown in the audio service. The next spec's getUserMedia is then occasionally told the device is already open and joins the dying session; the track start lands inside the teardown and fails. Chrome's verbose log shows the close and the failure on the same session id, 1.4ms apart.

A single audio track acquired in beforeAll and released in afterAll keeps the consumer count above zero for the file's whole run, so no teardown ever races a join. Ten consecutive runs in an environment reproducing the failure on roughly two runs in five came back clean; on this branch the suite shows only the three failures #2 fixes, with the intermittent one gone.

Proposed upstream

The race is upstream's, present on pristine 0.21.2 at the same rate, so the same change is proposed to onsip/SIP.js as onsip#1128. The fork ships it without waiting on that review; if upstream lands it first, this becomes a cherry-pick.

Chrome coalesces getUserMedia calls for one device onto a shared device
session. Every spec boundary in this file stops all tracks, dropping the
session's consumer count to zero and starting an asynchronous teardown in the
audio service; the next spec's getUserMedia is then occasionally told the
device is already open and joins the dying session, failing with
NotReadableError: Could not start audio source. Which spec fails depends on
where the race lands, so it presents as an intermittent failure scattered
across the interop tests, more frequent on loaded machines.

A single audio track acquired for the file's whole run keeps the consumer
count above zero, so no teardown ever races a join. Ten consecutive runs in
an environment reproducing the failure on roughly two in five runs came back
clean.
@23Skidoo 23Skidoo changed the title session-description-handler.spec.ts: Fix flaky NotReadableError [test only] session-description-handler.spec.ts: Fix flaky NotReadableError Aug 26, 2026
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