Skip to content

bug: frontend test: fallback countdown races dialog deletion, causing null dereference and fixture leaks #3908

Open

Description

@zackees

Location

test/cmocka/test_fallback_warning_dialog.cpp:129-141 (countdown_moves_the_progress):

show(s, true, 2000);
settle(400);
auto *progress = s.dialog->findChild<QProgressBar *>("progress");

show pumps Qt events for 20 ms (54-60); settle pumps events, sends deferred deletes and processes events again (64-68). The window has WA_DeleteOnClose (frontend/dialogs/OBSFallbackWarning.cpp.hpp:10), uses a real QElapsedTimer (55-59,87), and finishes/closes when elapsed >= countdown (101-105). QPointer becomes null on deletion.

Class / reachability

Intermittent test null-pointer dereference, followed by test-fixture leaks. Trusted local test execution only. No remote-input or credential-leak finding. This report concerns the isolated Qt dialog test, not the security properties of fallback callers.

Evidence and frequency

PR #3871 attempt 1, job 128409082134 failed: test_fallback_warning_dialog exit=1 (8.3s). The PR ports hotkey getters and changes no frontend dialog code. Its sanitize-asan artifact contains tests/test_fallback_warning_dialog.log and .ubsan.25488.

The test log reports 8/9 cases passing, with only countdown_moves_the_progress failing at line 135 (null OBSFallbackWarning / QObject, then SIGSEGV). The leak stack explicitly runs from settle line 66 / caller line 133 through QTest::qWait, QTimer, OBSFallbackWarning::tick:104, ended, and the callback's ends.push_back:58. Thus the countdown actually completed during the wait, before line 135.

LeakSanitizer reports 180 bytes / 4 allocations: QObject private state from Shown:46 (120), QPointer weak-reference state from show:56 (16), vector allocation from callback line 58 (4), connection state from line 57 (40). Likely secondary to cmocka signal recovery bypassing stack C++ destructors after the fault, rather than a leaked live dialog.

Bounded convenience sample (not an exhaustive incidence estimate): 1 failure / 17 actual test executions checked, 16 passes. Earliest observed failure in this sample: 2026-11-07 13:02 UTC. The test file has been unchanged since #2238 (2026-10-25, 4d73452); this does not establish when failures first began.

Cohort Actual test executions Pass Fail
Recent PRs Nov 7, including reported failure and previous hotkey run 10 9 1
Older PRs Nov 6 3 3 0
Master scheduled sanitizers Nov 3–6 4 4 0

Three sampled successful merge-group runs (42376234390,42371446973,42370675616) have no asan execution; do not count their green workflows as passes. ci.yml --event push returned no runs; current master push workflow push.yaml run 42371994305 only has asan cache-state/refresh jobs and a skipped Sanitize call, also not a test pass.

Previous same hotkey branch: 42368049799 / 128391834166, test exit=0 (6.2s). Representative other PR pass: 42373580556 / 128410223942. Master scheduled passes: 42235134335 / 127950774150, 42049821983 / 127322784486, 41851659014 / 126649434446, 41655492536 / 125984690630.

PR #3871 attempt 2 job 128424520098 remains in progress at this investigation's check; no rerun requested here. One older failed asan job (128221813245) contains no result for this test and is excluded.

Cause and proposed fix / failing-test sketch

The test assumes that pumping events for nominally 400 ms always returns before a real 2000 ms countdown expires. Scheduling/sanitizer overhead can exceed that window. The dialog correctly emits CountdownDone, closes, and deletes itself while Qt events are being pumped. Missing QApplication pumping is not the cause: pumping is visible both in source and in the artifact stack. This is the wall-clock/load class described by #838, though that issue covers audio tests, not this dialog.

Maintainer decision required: the direct correction is in the existing C++ test, which workers must not edit (same policy boundary as #3789/#3808/#3810). No small non-test frontend correctness fix is justified by these logs; changing automatic closure to satisfy the test would change intended behavior.

Prefer a controlled clock/tick observation for progress assertions so reaching nonzero progress cannot race expiration; check lifetime before dereferencing, with cleanup owned outside cmocka's signal/longjmp path. A null assertion alone improves diagnostics but does not fix timing. Increasing the countdown or applying the timing resource lock is only a mitigation. RED sketch: deliberately deschedule/delay the progress test across the countdown deadline; GREEN must inspect intermediate progress without relying on beating wall time. New tests alone cannot remove the existing failing assumption. No source/test edits or claim made during triage.

Searches for test_fallback_warning_dialog, countdown_moves_the_progress, fallback warning and fallback+sanitizer found no dedicated existing report. #1390 mentions the test in the broad native-test migration work; #838 is related background, not a duplicate.

Activity

  1. zackees commented on Nov 11, 2026

    @zackees
    MemberAuthor

    Coordinator investigation confirms the remaining failure is in the existing C++ fixture: settle(400) may deliver deferred deletion after the 2000 ms countdown under load, and the fixture dereferences its QPointer before checking lifetime. The product intentionally auto-closes and must not be changed to rescue this assertion. Maintainer authorization needed: may a narrowly scoped fixture correction use deterministic countdown/event synchronization and safe lifetime observation, preserving automatic completion, exactly-once end and every existing functional assertion? Recommendation: permit only that test correction with focused RED→GREEN evidence; no timing-threshold relaxation or product behavior change. No existing test has been edited by this coordinator work. Reply beginning Decided: or Decision: can define the exception and clear human-review-needed.

  2. moved this from Triage to Needs decision in obs-rust Multiviewon Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghuman-review-neededEscalated: waits on the human maintainer

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions