Skip to content

test(cvcgl_media_audio): drain frames until each program has run - #855

Merged
transfix merged 1 commit into
masterfrom
test/media-audio-drain-until-done
Oct 28, 2026
Merged

transfix merged 1 commit into
masterfrom
test/media-audio-drain-until-done

Conversation

@transfix

@transfix transfix commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

cvcgl_media_audio aborts now and then on package-linux's Debug lanes:

cvcgl_media_audio.cpp:122: int main(): Assertion `root("deep.done").value() == "1" && "the deep-graph program ran"' failed.

It failed all 3 attempts in #834's run 40494020761 (package-linux / libcvc-debug, job 122154778441), and 1 attempt in master 83b6020's package-linux / libcvc-debug-grpc (job 122277740072). It passed on the next run of #834. #834 adds only benchmark files, so this is not its code. In the runs checked, it failed only in Debug lanes.

Root cause

The test sets a tick program, calls rt.drain() once, and asserts the program finished. A drain doesn't promise that. Runtime::drain() pumps the app scheduler for a bounded slice (kPumpMaxSteps 200,000, kPumpMaxSeconds 0.1 s, a time_budget whose second half is on the thread's CPU clock). A program that needs more goes on in the next frame's drain, by design. The deep-graph program builds a 64-level mix/gain graph and opens two streams. The Debug lanes build with coverage instrumentation, and on a loaded runner that program can need more than one slice. No warning is printed because nothing failed: the program was still running.

This is the mechanism the code shows. I have not reproduced the failure locally (this box has no Debug coverage build), so the test now prints how many drains a program took when it was more than one. A later failure will show whether that was the cause.

Fix

The test drains frames until each program has set its key (cap.done, deep.done), for 10 s at most, then asserts as before. The programs already guard against re-running once their key is set.

Evidence

  • Local (Windows, MSVC 14.44 Release): cvcgl_media_audio passes 3/3, each program finishing in its first drain.
  • The mechanism, locally: I prepended a 300,000-iteration busy loop to the deep-graph program (a temporary edit, not in this PR). It finished after 41 drains, with no warning, and the test passed. After the first drain deep.done was unset, which is exactly where the old single-drain test aborted.
  • CI: the required checks passed. The Debug lanes run this test on every run. At merge, this branch's run 40616892284 had passed package-macos / libcvc-debug; package-linux's two Debug lanes were still running. The push run of all four fixes on ci/full/package-lanes (40615210987) was still queued. The failure was intermittent, so a green run alone is weak evidence; a future slow run now prints "deep.done after N drains" instead of aborting.

The test ran one rt.drain() after setting each tick program and then asserted
the program had finished. A drain pumps the app scheduler for a bounded slice
(0.1 s, its second half on the thread's CPU clock), and a program that needs
more carries on in the next frame's drain, by design. In package-linux's
Debug lanes, which build with coverage instrumentation, the deep-graph program
(a 64-level mix/gain graph, two stream-opens) can need more than one
slice on a loaded runner: "the deep-graph program ran" failed on all 3
attempts in #834's run 40494020761 (job 122154778441) and on 1 attempt in
master 83b6020's debug-grpc job; in the runs checked, only in Debug lanes.

The test now drains until the program has set its key, for 10 s at most, and
prints how many drains that took when it was more than one.
@transfix
transfix merged commit 3e17f40 into master Oct 28, 2026
20 of 24 checks passed
@transfix
transfix deleted the test/media-audio-drain-until-done branch October 29, 2026 20:54
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