Skip to content

session-description-handler.spec.ts: Fix flaky NotReadableError - #1128

Open
23Skidoo wants to merge 1 commit into
onsip:mainfrom
23Skidoo:audio-device-keepalive
Open

session-description-handler.spec.ts: Fix flaky NotReadableError#1128
23Skidoo wants to merge 1 commit into
onsip:mainfrom
23Skidoo:audio-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:

MSM::Closed({stream_type=DEVICE_AUDIO_CAPTURE}, {session_id=42FA...})
PLAS::OnCaptureError({code=0, message=Maximum allowed input device limit reached or an OS failure occurred.}) [session_id=42FA...]
UMP::OnTrackStarted({request_id = 260}, {session_id=42FA...}, {result=TRACK_START_FAILURE_AUDIO})

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. In an environment reproducing the failure on roughly two runs in five, ten consecutive runs with this change came back clean.


This contribution was prepared with LLM assistance (Claude): the investigation, the change, and this description. A human reviewed it and stands behind the submission.

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.
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