Skip to content

Flaky: test_deinterlace_2x_field_order after_pause_linear_2x_50i_into_50 skips 3 fields on a loaded Dell runner #5374

Closed

Description

@rdoupe

test_deinterlace_2x_field_order failed in the merge queue against the C reference (Rust Tier 2 Linux, tests OFF) and ejected an unrelated hotkey PR (#5371).

  • Run: https://github.com/obs-rust/obs-studio/actions/runs/44831878902 (job 136623927763), self-hosted Dell runner, 2026-11-20 23:04 UTC.
  • Case: after_pause_linear_2x_50i_into_50 at test/cmocka/test_deinterlace_2x_field_order.c:516: "3 fields skipped, 1 skips past the cadence (at most 3 in a row), allowed one skip of 1". The test took 25.7 s; the other cadence cases in the same run passed.
  • The change under test touched only obs-hotkey, and the same test passed on the hybrid library in that run, so this looks like real-time pacing under runner load rather than a regression.

Not added to test/cmocka/known-flaky.txt yet; a single occurrence so far. If it repeats, registering it there (as #5054 did for #4680) keeps it from ejecting queue groups while the root cause is found.

Activity

  1. added
    bug
    on Nov 20, 2026
  2. zackees commented on Nov 21, 2026

    @zackees
    Member

    Triage

    Verdict: a timing assumption in the test, not a libobs bug. The canvas skipped rendering for about 3 ticks (a 60 ms graphics-thread stall on a loaded host). libobs reported the missing ticks as repeated frames and then showed the field that was due, as designed. The test assumes a delay is never more than one late tick (#2904), so it counted the stall as a cadence bug. The fix is test-only: make the test account for the ticks libobs reports as not rendered, without loosening the assertions.

    Evidence

    Job 136623927763 ran on the self-hosted runner dell-fsx3mn2-5 (tests OFF, so this is the C reference). The hybrid library passed the same entry in that run. Log line 2772:

    linear 2x, top field first, after a pause, 50i into 50 fps: 78 output frames, 7 unrecognised,
    68 fields shown, 3 skipped (at most 3 in a row), held for up to 4 frames, 0 steps back in time: 0 1 2 6 7 8 ...
    

    At 50i into 50 fps, one field is due every tick (allowed_gap 0, allowed_held 1). The numbers match a 3-tick stall exactly:

    • Field 2 was held for 4 output frames: 1 rendered frame plus 3 repeats. The 68 shown fields take 71 frames, so there are 3 extra frames.
    • Fields 3, 4 and 5 were never shown: 3 fields, one for each tick that was not rendered.
    • Field 3 is the second field of the frame already on screen. It needed no new input, so a late push from play() cannot explain why it is missing. It is missing only if no render ran during its 20 ms slot.
    • Nothing went backwards, and every field from 6 to 70 was shown in order.

    Scope: I read the logs of every failed "Rust Tier 2 Linux (tests …)" job in failed Pull/Push runs from 2026-11-09 to now (the latest 400 failed runs: 63 jobs, 24 on Dell runners and 39 on hosted runners). This is the only deinterlace failure among them. It ran on a Dell runner. The case is already RUN_SERIAL (test/cmocka/tests.d/test_deinterlace_2x_field_order.cmake:33-36), but RUN_SERIAL only serializes tests inside one ctest. The Dell host runs several runner slots side by side (dell-fsx3mn2-1 to -6), and those other jobs are the load. The 2026-11-08 inventory in #456 saw cadence failures at :493/516/522 for all five rates under heavy host load, both hybrid and C reference.

    Mechanism (origin/master)

    1. The stall becomes repeated frames. video_sleep (libobs/obs-video.c.h:539-554) gets count = elapsed / interval from obs_video_pacing_step (libobs/obs-video-pacing.c.h:21-38) when the graphics thread oversleeps, and adds count - 1 to the lagged-frames stat (obs-video.c.h:551, exposed as obs_get_lagged_frames(), obs.h:943). video_output_lock_frame stores that count on the frame (libobs/media-io/video-io.c.h:536-562). The video-io thread then calls every raw-video callback once per count with the same image (video_output_cur_frame, video-io.c.h:121-190, looped at :208-210). The test's raw_video (test/cmocka/test_deinterlace_2x_field_order.c:130-147) counts each repeat as a held output frame.
    2. Deinterlacing catches up to wall time. On the next real render, deinterlace_get_closest_frames (libobs/obs-source-deinterlace.c.h:92-148) uses the new sys_time. obs_source_deinterlace_pacing_hold (libobs/obs-source-deinterlace-pacing.c.h:28-41) and the buffered walk in ready_deinterlace_frames (obs-source-deinterlace.c.h:29-77) drop the fields whose time has passed. Upstream does the same, and it has to: showing old fields after a stall would push video out of sync with audio for good.
    3. The test assumes a stall is never longer than one tick. check_field_order allows "one skip of allowed_gap + 1" (test_deinterlace_2x_field_order.c:506-517, from test(deinterlace): allow one skipped field for a single late tick (#456) #2904) and one hold of allowed_held + 1 (:499-505, :518-523). The comment at :506-510 gives the reason: "a single late tick". A stall of N ticks at a canvas no faster than the field rate costs N fields and N - 1 repeats, so any N ≥ 2 fails here, whichever library is under test. play() (:190-214) sets timestamps from the wall clock, and the test never asks libobs whether the canvas rendered each tick.

    This is a third signature beside the two in #456. #2904 covered single-tick delays. Multi-tick stalls were never covered.

    Fix plan (test-only, deterministic, no assertion weakened)

    1. First step (merge-queue shield): this ejected obs-hotkey: swap hotkey background-state query to safe Rust (Refs #5259) #5371 from the queue and is not registered. Add one line to test/cmocka/known-flaky.txt:
      ^test_deinterlace_2x_field_order_(60i_into_60|50i_into_50|50i_into_60|50i_into_30|60i_into_50)$ #5374 a multi-tick render stall on a loaded runner skips fields; the test assumes at most one late tick
      All five rates share this mechanism (test_deinterlace_2x_field_order is timing-sensitive (yadif 2x 60i into 60): startup underrun and load-induced hold #456 inventory). If the fix will take more than a day, land this line as a separate small PR first so the queue stops ejecting groups. The registry only retries once in the normal OFF/ON run, never in --repeat runs, so it cannot hide a failure in the acceptance runs below. The fix PR removes the line, because the registry says to remove an entry once its issue is resolved.
    2. Confirm the cause in the RED step. In raw_video, record for each output frame the obs_get_lagged_frames() count and video_output_get_skipped_frames(obs_get_video()) (libobs/media-io/video-io.h:325). Print the lagged and dropped counts for the measured window in the case's summary line. Reproduce under load (recipe below) and show that each failing skip comes with a lagged count ≥ the gap. If a failing skip shows no reported lag, stop: that is a real pacing bug, and it gets fixed in libobs, RED first, not in the test.
    3. GREEN: check fields against the ticks that were rendered, not against output-frame counts.
      • A repeated frame that libobs reports as lagged (or as dropped by video-io) is not a hold.
      • A skip is excused only up to the number of ticks libobs reported as lagged or dropped between the two shown fields. The skip and the stall must fall in the same window, and the gap may not be larger than the stall.
      • Everything else stays as it is, including the test(deinterlace): allow one skipped field for a single late tick (#456) #2904 allowance. With zero lag the assertions are exactly the current ones. A skip, hold, step backwards or field shortfall with no reported lag still fails.
      • Keep every assertion and threshold. Add no sleeps, no frame-count waits, and no retry of the case. Put the accounting in a pure function and test it on fixed sequences:
        • skip with matching lag → pass
        • same skip with no lag → fail
        • skip larger than the lag → fail
        • lag repeats not counted as holds
        • a hold beyond the cadence with no lag → fail
    4. Follow-up check (optional): if every test(deinterlace): allow one skipped field for a single late tick (#456) #2904 one-field skip in the load runs comes with reported lag, the worker may tighten that allowance back to 0. That is stricter, so it needs no decision. test_deinterlace_2x_field_order is timing-sensitive (yadif 2x 60i into 60): startup underrun and load-induced hold #456 signature 1 (20 fields skipped at startup) may be the same stall. Report what the new counters show for it on test_deinterlace_2x_field_order is timing-sensitive (yadif 2x 60i into 60): startup underrun and load-induced hold #456. Do not close test_deinterlace_2x_field_order is timing-sensitive (yadif 2x 60i into 60): startup underrun and load-induced hold #456 on this fix alone.

    Acceptance

    No open decision: the test's timing assumption is wrong, so a test-only fix is allowed, and the plan above keeps every assertion as strict as it is now. Labels: P2 (it ejects merge-queue groups and fails on the C reference too), size:M (one test file, plus a reproduction under load).

  3. zackees commented on Nov 21, 2026

    @zackees
    Member

    /ready

  4. added
    P2
    size:M
    on Nov 21, 2026
  5. added
    ready
    on Nov 22, 2026
  6. rdoupe commented on Nov 22, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: I'll follow the triage plan: record lagged/dropped ticks per output frame, confirm under load that each failing skip comes with a matching reported stall (RED), then check fields against rendered ticks with a pure accounting function and its fixed-sequence cases (GREEN). No assertion is loosened.

  7. added a commit that references this issue on Nov 23, 2026
    7e17e73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2bugreadysize:M

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions