Skip to content

ci: A lost runner blocks the merge queue for up to 2 h; parity tests are most of the Rust test time #2593

Closed

Description

@vpacher

Summary

A port PR can take up to 2 h from "ready" to merged. Two causes are measurable:

  • A. Queue stall. When a runner dies, the job stays in_progress. Nothing re-runs it. Only the job timeout-minutes (60 for Fast Gate) or the merge queue check_response_timeout_minutes (120) ends it.
  • B. Parity test time. Every port PR runs the whole Rust workspace, three times (PR, merge queue, master push). The Tier 3 parity tests are most of that time.

The data below is from #2514 (runs on 2026-10-26 and 2026-10-27). Measurements on mbmax are local; CI numbers are from the run logs.

A. Queue stall after a lost runner

Evidence

Merge queue run 40478704942 (#2514), Fast Gate job 122103507681:

Time (UTC) Event
09:09:37 #2514 enters the merge queue
09:10:32 Fast Gate starts
09:20:32 Unit test step: Process completed with exit code 143 (runner lost)
09:20:32 All later steps show "completed"; the job stays in_progress
09:56:40 Still in_progress, run_attempt 1, no retry. PR removed from the queue by hand

Without the manual removal, the job ends at about 10:10 (job timeout 60 min). If GitHub never finalizes the job, the queue removes the PR at about 11:09 (queue timeout 120 min). Run 40380261405 attempt 2 shows the same: the runner died at 19:23:25, and the job ended at 20:07:54 (44 min later, "The hosted runner lost communication with the server").

The cause of these runner losses was a test in #2514 (fixed in 8653afd4a: a test bitmap of up to 17 GB). Other causes can kill a runner too. The stall comes from the timeouts, not from the cause.

Proposal

  1. Set each job's timeout-minutes to about 2x its normal duration. Normal durations (obs-graphics: Port the libnsgif state machine and public API (#2510) #2514 PR run 40475920132, all green):

    Job Normal Timeout now Proposed
    Rust Tests (windows) 13.8 min 60 30
    Rust Tier 2 macos-26 9.8 min 90 25
    Rust Tests (macos) 9.6 min 60 25
    Rust Tier 2 windows 9.3 min 90 25
    Fast Gate 7.7 min 60 20
  2. Set the merge queue check_response_timeout_minutes to 60 (now 120). The PR run of obs-graphics: Port the libnsgif state machine and public API (#2510) #2514 took 22 min wall time.

  3. Optional: re-run a job automatically once when its runner is lost (workflow_job completed with the "lost communication" or exit-143 annotation). Today the coordinator does this by hand.

  4. Optional: print free -m and df -h every 30 s during the unit test step. Then the log of the next lost runner shows memory and disk.

B. Parity test time

Evidence

  1. Every port PR tests the whole workspace. ci/rust_scope.py treats any change under libobs/ as "workspace", because the C oracle compiles libobs. A port always changes libobs/. Log: == test scope: workspace [].

  2. One test binary is most of the test time. macOS Rust Tests (obs-graphics: Port the libnsgif state machine and public API (#2510) #2514, job 121928442384): compile 3.5 min, test execution 7.7 min; obs_tests_core 339 s of 461 s.

  3. Parity tests are most of obs_tests_core. mbmax, --test-threads=3:

    Selection Tests Time
    All 2721 321 s
    *_parity:: only 731 (27 %) 269 s (84 %)
    All others 1990 69 s
  4. A few modules are most of the parity time. Per module (mbmax, 3 threads): obs_core::audio_discard_parity 68 s, source::video_tick_parity 61 s, hotkey::translations_parity 39 s, source::audio_timing_parity 21 s, obs_core::audio_mix_parity 20 s. The top 5 are 54 %, the top 11 are 77 %. The first two also show SLOW [> 60.000s] on CI.

  5. Case counts are hard-coded. 160 of 168 parity files use proptest; 114 set with_cases(N) (most often 20 000). PROPTEST_CASES does not change an explicit with_cases, so an environment setting cannot reduce them.

  6. Parity runs three times per port PR. The merge queue uses the same scope as the PR (ci_scope.py against merge_group.base_sha). The master push runs all lanes again.

Proposal

Select parity tests by what changed. Keep the full run as the safety net.

  1. PR: run the parity tests of a port only when its Rust module, its C source or the C oracle changed. The source groups in libobs/build/source-sets.json already map C files to ported groups.
  2. Merge queue: build and link all tests. Run Tier 1, the characterization tests and Tier 2 in full. Run a port's parity tests only when its inputs changed between the PR's last green base and the queue base. A verdict per port (hash of the Rust module, the C source and the oracle) can use the existing verdict cache (verdict-scope).
  3. Master push or nightly: run all parity tests.
  4. Short term, without a CI change: reduce the cases of the slowest modules (item 4), or move them to the nightly run.
  5. Optional: a shared cases(n) helper (for example, 10 % on PR, full on master and nightly). This needs a change in the 114 files.

Limitations

  • Local times (mbmax M1 Max) are not CI times. The ratios (84 % parity, top-5 share) are the useful part.
  • I did not measure the runner queue wait and the time between jobs (for example, Windows and macOS Tier 2 needs the Linux Rust tests). They can be part of the 2 h.
  • Selection by changed port can miss an interaction between ports. The master push or nightly run finds it later, not at merge time.

Decisions for the coordinator

  • A: the timeout values, and whether to add the automatic re-run.
  • B: which selection rule (PR, queue, nightly), and whether to start with item 4.

Activity

  1. vpacher commented on Oct 27, 2026

    @vpacher
    MemberAuthor

    Addition: a memory budget for test binaries (fast feedback instead of a lost runner)

    The runner losses on #2514 came from one test that used up to 17 GB on some random seeds (fixed in 8653afd4a). Any parity test with a generated size (width x height, a count, a length) that drives an allocation can do the same. When it happens, the runner dies without a test name. The log shows only exit 143, and the merge queue stalls (part A).

    Proposal: run the Rust test binaries in Fast Gate and Rust Tests under a memory limit. Then a test over the budget fails as a normal test failure with its name, in minutes, instead of killing the runner.

    • Linux: a cgroup limit for the test step (systemd-run --scope -p MemoryMax=...) or ulimit -v for each test binary.
    • Budget: well below the runner's 16 GB (for example 4 GB), so the runner always survives.

    Pitfall: a new limit can fail existing tests from other PRs and authors that already use a lot of memory on some seeds. Their next unrelated PR then fails on someone else's test. To prevent this:

    1. Measure first. Run all test binaries several times (several seeds) and record the peak memory per binary. Set the budget above the highest peak found.
    2. Report-only first. For about a week, print the peak memory per binary in the log and flag binaries over the budget, without failing the job.
    3. Fix the tests that were flagged, then enforce. File an issue for each flagged test, then turn the limit on.

    We will do step 1 for the parity tests and post the peaks here.

  2. vpacher commented on Oct 27, 2026

    @vpacher
    MemberAuthor

    Step 1 measured, for the parity tests. CT104 (Linux), every *_parity module of the 5 test binaries that have them (155 modules), 5 random seeds each, each run in its own cgroup with an 8 GB cap, --test-threads 2. Binaries from before 8653afd4a, so gif_parity is the control.

    Peak (highest of 5 seeds) Module
    476 MB, and 1 run OOM-killed at 8 GB render::gif_parity (before the fix; after the fix 154 MB at most in 50 runs)
    95 MB hotkey::translations_parity
    71 MB source::transition_start_parity
    24 MB tests::platform::pipe_parity (obs_util)
    12 MB or less the other 151 modules
    • Every other module passed on every seed, with no OOM. The two heaviest are stable across seeds.
    • With obs-graphics: Port the libnsgif state machine and public API (#2510) #2514 merged, a 1 GB budget per test binary fails no current parity test, so for the parity tests the pitfall is small.
    • Not measured yet: the other tests (Tier 1, characterization), and rare seeds (5 seeds per module; gif_parity went over in about 3 of 10 runs). The report-only step covers both.
  3. vpacher commented on Oct 27, 2026

    @vpacher
    MemberAuthor

    Another time sink, found while measuring: #2603 (fix PR #2604). Since #2061 (10-24), soldr cook fails in every Rust lane on serde_json's features, so the cook cache is never saved or restored, and every lane compiles all external crates on every run. Before #2061, Fast Gate restored 886.7 MB of cooked dependencies in 18.5 s. With about 8 Rust lanes per run and 3 runs per port PR, this is probably the largest single item here. #2603 also notes the cache size (7.9 of 10 GB used now) and the silent cook: failed ... continuing line.

  4. zackees commented on Oct 27, 2026

    @zackees
    Member

    Decided: apply the timeout half of this issue (A), keep the parity-selection half (B) for the maintainer.

    That split is not a dodge; the two halves are different kinds of change. A is a measured, reversible config value that the project's own rules do not constrain. B changes what PR CI proves before a merge, which is the testing policy, and the coordinator does not rewrite that on its own.

    A — decided

    Decided: the values below are the policy. Sources for the numbers are this issue's own tables: job durations from #2514's green PR run (40475920132), queue wall time 22 min, and the two stalls (40478704942, 40380261405 attempt 2).

    • timeout-minutes at about 2× the normal duration: Rust Tests (windows) 30, Rust Tests (macos) 25, Fast Gate 20, Rust Tier 2 macos-26 25, Rust Tier 2 windows 25. A 60/90-minute timeout on a 8–14-minute job is what turned one lost runner into a 44–60-minute stall; 2× keeps a slow-but-alive job from being killed while bounding a dead one.
    • Merge queue check_response_timeout_minutes 120 → 60. The queue response is a full PR run (22 min measured); 60 leaves room for a slow runner and halves the worst case.
    • Reasons this is a decision and not an escalation: timeout-minutes and the queue's response timeout are ordinary CI configuration, they are changed in this repo's own files, and every value is reversible in one commit. Nothing about the product, the constitution, licensing or security turns on them.

    Still open inside A, and deliberately not decided here: the automatic re-run on a lost runner (A3) and the free -m/df -h sampling (A4). A re-run policy is a workflow-behaviour choice with a cost (a lost runner re-runs the whole job), and A4 is diagnostic instrumentation; both are safe defaults either way, so the worker that takes this issue may implement A4 and leave A3 unless the maintainer says otherwise.

    B — escalated

    The rules do not settle it. ci/rust_scope.py scopes every libobs/ change to the whole workspace because the C oracle compiles libobs, and the parity tests are 84 % of obs_tests_core's time; selecting them by changed port is a real reduction, but it is also a change in what a green PR means, and this issue's own "Limitations" names the failure mode (an interaction between ports found later, not at merge). That trade-off is the maintainer's, not the coordinator's:

    • B1 parity selection at PR time only, full run in the queue and on master;
    • B2 selection at PR time and in the queue by port verdict hash, full run on the master push or nightly;
    • B3 no selection; take the cheap win (item 4: reduce cases in the slowest modules, or move them to nightly) and revisit.

    Recommendation: B1 now, B3's item 4 as the same PR's cheap half, and keep the queue running everything until the verdict cache has a few weeks of no-miss. B2 is the end state worth designing, but it removes the last full check before master, and the master push that would catch a miss can already be the red one.

    Ready, as far as it can be

    Part A meets the definition of Ready once split: each value is a one-line config change with a testable acceptance criterion (the workflow parses, ci/test_ci_toml.py and the ci.toml [allow] set stay consistent, and a job that exceeds the new bound is killed rather than left in_progress). I am labelling this issue ready for A only; B waits on the maintainer and is labelled so.

    human-review-needed added for B. Answer with a comment whose first line starts Decided: (or by editing the label); then part B is claimable as its own issue.

  5. added
    ready
    infra
    P2
    size:M
    human-review-needed
    on Oct 27, 2026
  6. removed
    human-review-needed
    on Oct 27, 2026
  7. vpacher commented on Oct 27, 2026

    @vpacher
    MemberAuthor

    Timeline of one clean merge (#2514, head 8653afd4a, 2026-10-27, UTC). All jobs green, no re-run.

    Phase Time Duration
    PR run 40485175636 10:00:51 → 10:26:40 26 min
    Green → in the merge queue 10:26:40 → 10:27:12 32 s
    Queue run 40488616991 10:27:30 → 10:54:00 26.5 min
    Queue green → merged 10:54:00 → 10:54:03 3 s
    Total about 53 min

    Where the time goes.

    1. Not the runner queue. No job waited more than 1.8 min for a runner; most waited 0.1 min.

    2. Two job stages in series. The Windows and macOS lanes are created only when Fast Gate ends:

      Run Fast Gate Then Windows/macOS lanes Run length
      PR 0.4 → 11.2 min created at 11.2 min, run 9.0–14.3 min 25.6 min
      Queue 2.1 → 10.4 min created at 10.4 min, run 7.1–14.9 min 26.0 min

      If the Windows and macOS lanes started with Fast Gate, a run would take about 15 min (the longest lane), and a clean merge about 30 min instead of 53.

    3. Runner speed varies. Fast Gate took 7.7 to 11.3 min today for the same kind of change.

    4. Master pushes run one after the other. The master push of build: Name serde_json's std feature so soldr cook builds again (#2603) #2604 (7140eb3d4) was created at 11:11:54 and started at 11:19:30, after the master push of obs-graphics: Port the libnsgif state machine and public API (#2510) #2514 ended (7.5 min wait). Superseded master push runs are cancelled.

    5. A lost runner costs much more. The queue run before this one (40478704942) lost its Fast Gate runner at 09:20:32 (part A). Cancelling the run took 9 min (requested about 09:57, cancelled at 10:05:32), because GitHub first had to give up on the lost runner.

    Compute, not only wall time. The parity tests run in 3 lanes per run (Fast Gate, Rust Tests macOS, Rust Tests Windows), and a port PR has at least 3 runs (PR, queue, master push): 9 executions, about 40 to 45 runner minutes per port PR. Every extra push or re-run adds 3 more.

    Dependency compile. In these runs every lane also compiled all external crates, because soldr cook failed (#2603, fixed by #2604; status of the cache in #2603).

    Summary of what can make a merge faster:

    Change Expected effect
    Windows/macOS lanes in parallel with Fast Gate about 10 min less per run, about 20 min less per clean merge
    Cook cache for all platforms (#2603) dependency compile removed from every Rust lane
    Parity tests only for changed ports (part B) about 4 to 5 min less per Rust lane, mostly in the queue and on master
    Job timeouts at about 2x normal (part A) a lost runner costs at most about 20 to 30 min, not 60 to 120
  8. zackees commented on Oct 27, 2026

    @zackees
    Member

    Claiming: implement part A of this issue — job timeout-minutes at about 2× the measured duration, per the Decided: above.

    Plan (one PR, focused CI config change with local RED evidence):

    1. RED: a ci/test_ci_job_timeouts.py pinning the decided bounds in .github/workflows/build-project.yaml (rust-tests-linux/Fast Gate 20; rust-tests windows 30, macos-26 25; rust-tier2 windows 25, macos-26 25). It fails on current master.
    2. GREEN: set those timeout-minutes so a lost runner is bounded at ~2× the normal job time instead of 60/90 minutes.

    Out of this diff: the merge-queue check_response_timeout_minutes 120→60 is a repository ruleset setting, not a tracked file, so it cannot be a file change; and A3 (auto re-run on a lost runner) is left alone as the decision says. A4 (free/df sampling) is diagnostic and left for a follow-up.

    Expected first PR: within the hour.

  9. zackees commented on Oct 27, 2026

    @zackees
    Member

    Part A opened as #2618 (ready, not draft).

    • RED aea90e5ad: ci/test_ci_job_timeouts.py pins the decided bounds, 3 failures on current master.
    • GREEN 75797a36c: rust-tests-linux 60→20, rust-tests 60→windows 30 / macos-26 25, rust-tier2 90→25 in .github/workflows/build-project.yaml; uv run python -m unittest ci/test_ci_job_timeouts.py OK, ./lint ok.
    • The merge-queue check_response_timeout_minutes 120→60 is a ruleset setting, not a file, so it is not in the diff; A3 is left as-is and A4 is a follow-up.

    Watching it through CI (workflow change). Part B stays with the maintainer.

  10. zackees commented on Oct 27, 2026

    @zackees
    Member

    Part A landed as #2618 (merged 12:37 UTC, queue run green, Fast Gate passed inside the new bound).

    On master now, in .github/workflows/build-project.yaml: rust-tests-linux 20, rust-tests windows 30 / macos-26 25, rust-tier2 25, pinned by ci/test_ci_job_timeouts.py.

    Not done by this worker, and why: the merge-queue check_response_timeout_minutes 120→60 the decision names is a repository ruleset (master merge queue (#692), id 25065309), not a tracked file — it cannot be a file change, and changing org settings needs the maintainer/coordinator (one gh api PUT, it is currently 120). A3 (auto re-run on a lost runner) is left as-is and A4 (free/df sampling) is a follow-up, per the decision. Part B stays with the maintainer.

  11. 13 remaining items

  12. added
    ready
    on Oct 30, 2026
  13. zackees commented on Oct 30, 2026

    @zackees
    Member

    Part B: #2991 (green, in the merge queue). Converts every with_cases parity site; nothing left for a follow-up.

  14. zackees commented on Oct 30, 2026

    @zackees
    Member

    Done. A: job timeouts (#2618), merge-queue response timeout 120 → 60 (ruleset 25065309), memory/disk sampling A4 (#2980); A3 auto re-run not adopted per the Decided above. B: parity proptest cases scaled by CI level (#2991: reduced on PR/queue/master, full on nightly/release; parity time in obs-tests-core 98.7 s → 42.9 s locally). Related speedups: macOS/Windows lanes start with Fast Gate (#2999, #2985); remaining critical-path work batched under #2888, #2072, #1592.

  15. moved this from Needs decision to Done in obs-rust Multiviewon Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2infrareadysize:M

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions