Skip to content

test: test_pulse_monitor_device's wireplumber.terminated marker is missing when the lint gate runs the ci suites in parallel #2972

Closed

Description

@zackees

Summary

ci/test_pulse_monitor_device.py::PulseMonitorDeviceTest::test_the_sound_server_serves_the_test_binary failed once in a full ./lint run on obs-studio5 (master e2782b4ac), on the last assertion of the test:

AssertionError: False is not true : wireplumber

i.e. the wireplumber.terminated marker was missing after the run. It passed 4/4 when the same test was run alone or as its own file afterwards (uv run --no-project python -m unittest ci.test_pulse_monitor_device → 8 tests OK, 3 times in a row), so it is a flake under load, not a broken assertion.

Why the gate is the load

The lint lane runs every ci/test_*.py file concurrently (ci/local_gate.py:243, N at a time) beside the Rust compiles and Dylint. The pulse suite starts six python stubs and three daemons per test; under that contention a daemon can be gone by the time stop() runs.

Candidate race in the harness under test

test/cmocka/test_pulse_monitor_device.py:

def stop(process: subprocess.Popen) -> None:
    if process.poll() is None:
        process.terminate()
    process.wait()

The daemon stub writes <name>.terminated only from its SIGTERM handler. If the stub has already exited when stop() runs, terminate() is skipped and no marker is written — the assertion then fails even though the harness did stop what it had. A daemon stub exiting early on its own (a crash, or a signal it inherited) leaves no trace in the failure message either: the assertion prints only the name, not <name>.log or the stub's stderr.

Next step

Reproduce under the gate's concurrency (./lint in a loop, or the suite with N parallel files), and when it reproduces print the daemon log and its return code in the assertion message so the next failure says why. Then either wait on daemon exit before asserting the marker or accept "already exited" as a stopped daemon. #2480 closed an earlier "flaky when PulseAudio tests run in parallel" report against this file's family.

Frequency seen

One failure in two full lint runs today; 0 in 4 standalone runs.

Activity

  1. added
    bug
    on Oct 30, 2026
  2. zackees commented on Oct 30, 2026

    @zackees
    MemberAuthor

    Claiming: fix the wireplumber.terminated flake in test_pulse_monitor_device

    Plan (one PR):

    1. Reproduce the missing marker under the gate's parallel load (loop the suite alongside the other ci/test_*.py files).
    2. Make the failure message say why: print the daemon log, the stub's return code, and whether the marker file exists.
    3. Stop treating "the daemon already exited on its own" as a stopped daemon — wait for the marker when the stub is still alive, and surface the early-exit case as a real failure with its log.
    4. RED = the reproduces-under-load run / a deterministic unit case that seeds an already-exited stub; GREEN = the harness fix; run the suite through ./lint's concurrency.
      Expected first PR this tick.
  3. added
    ready
    on Oct 30, 2026
  4. zackees commented on Oct 30, 2026

    @zackees
    MemberAuthor

    PR #2974 — RED then GREEN, both commits pushed.

    • RED d772569a0: ci/test_pulse_monitor_device.py asserts a daemon that finished booting handled SIGTERM (marker + record agree) and that a daemon that died on its own is reported with its exit code and log. Red on master: FAIL: test_a_daemon_that_died_on_its_own_is_reported_with_its_log — AssertionError: "wireplumber exited 1 when the run ended" not found in "".
    • GREEN 2c7c0fc67: test/cmocka/test_pulse_monitor_device.py records each daemon's name and log, treats 0/-SIGTERM from a daemon that was alive as the expected stop (silent), and prints the daemon's name, exit code and log when it was already dead or needed SIGKILL. The stop no longer depends on a marker a daemon killed mid-boot cannot write.

    Verification: uv run --no-project python -m unittest ci.test_pulse_monitor_device → 10 passed; ./lint lane lint ok (45.7s). The race itself reproduced 0 times in 108 parallel runs locally (9 rounds × 12 concurrent) plus 16 concurrent runs — it is load-sensitive on the gate, so the deterministic slow-boot stub is the RED evidence rather than a lucky repro.

  5. zackees commented on Oct 30, 2026

    @zackees
    MemberAuthor

    PR #2973 is up and queued (merge-queue position 1): "test(ci): stop the pulse harness racing a slow daemon, and fail on a dead one".

    Root cause, measured. The flake reproduced deterministically at 2/32 when 32 copies of the failing case ran at once (the ./lint gate's shape): the harness stops the daemons as soon as pactl answers, and WirePlumber is still installing its SIGTERM handler then, so the default signal action kills it and no wireplumber.terminated marker is written. 0 failures in 64 concurrent runs after the fix.

    The fix keeps the assertion and makes the contract explicit: the test binary runs only once the private graph is up, so the fixture waits for every daemon to have recorded itself; a daemon that dies before recording is a failure with its log. The harness itself now watches WirePlumber in wait_for_server, re-checks every daemon after the blocking pactl call, and SIGKILLs a daemon that ignores SIGTERM after a 3 s deadline instead of waiting forever.

    ./lint ok (46.2 s, its concurrent ci/test_*.py run included); PR CI green and queued.

  6. zackees commented on Oct 30, 2026

    @zackees
    MemberAuthor

    Duplicate consolidation: the PR for this issue is #2973 (test/2972-pulse-marker), not #2974.

    Two worker ticks picked up the same claim within 30 s of each other and opened #2973 and #2974 for the same two files. I closed #2974 as the duplicate and kept #2973, which is the superset:

    • wait_for_server in test/cmocka/test_pulse_monitor_device.py now watches wireplumber too, and re-checks every daemon after pactl answers (that call blocks, so a daemon can die while it waits). Before, a wireplumber that had already exited let the harness run the test binary against a half-started graph and return its status — a silent pass, which is the "why did the marker just disappear" half of this report.
    • stop() bounds the shutdown: SIGTERM, STOP_TIMEOUT (3 s), then SIGKILL, so a hung sound server cannot hang the lint lane. test_a_daemon_that_ignores_sigterm_is_killed covers it.
    • Fixture-side, the binary now waits for every daemon to record itself (the boot race) and a daemon that dies before recording fails with its log.

    Follow-up worth a separate issue, from #2974's better idea: stop() could print a daemon's exit code and log when a daemon exits after startup but before the stop, which is the only remaining "missing marker with no explanation" shape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions