You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
frontend: RecordingShutdown polls every 10 ms on the UI thread while waiting for recording to stop #1283
frontend/widgets/RecordingShutdown.hpp:27-33: waits for recording to stop by polling every 10 ms on the UI thread until a timeout. It doesn't spin, but it blocks the UI for the whole wait.
Fix: wait for the output's stop signal (recording_stopped) asynchronously and continue shutdown from the callback, with the timeout as a single-shot timer, instead of a polling loop on the UI thread.
Test: a fake output that stops after N ms; shutdown completes while the UI event loop keeps processing events.
Claiming. Plan: wait for the output's stop signal asynchronously instead of a 10 ms polling loop on the UI thread; shutdown continues from the stop callback, with the existing timeout as a single-shot timer. RED: with a fake output that stops after N ms, shutdown completes while the UI event loop keeps processing events.
New live CI evidence from #1286 follow-up PR #1362, run 39081664635: both OFF job 117540316673 and ON job 117540316794 failed the unchanged test_recording_shutdown_wait at line 121 (out.active.load() is not false). OFF also failed line 142 (stopped is not false) in the following no-stop case. Each suite registered 295 tests; the new startup diagnostics passed. No retry, skip, or assertion change performed.
Observed OFF log: stopped 1 after 220 ms, posted timer fired 1 (while waiting 1), then line 121; next case no stop: returned 1 after 300 ms then line 142.
Source inspection identifies a concrete race candidate in the already-merged #1342 implementation: State::Stopped() returns deactivated.load() || !active(). The unchanged fixture signals deactivate before setting active=false, so the UI thread can observe the signal and return before the active flag clears. The following-case failure may be fallout from cmocka's failing assertion bypassing the stack fixture's normal destruction; that part is an inference requiring reproduction. These are state assertions, not merely tight elapsed-time bounds; scheduling the test serially would not establish a correctness fix.
Recording here under the existing fresh claim rather than starting competing source work. This is currently blocking #1362 CI; its build job succeeded. Raw job logs are retained locally under build_ci_audit/recovery-latest-{off,on}-.log.
Follow-up local evidence (no production/source-test edits):
Compiled and ran the unchanged test_recording_shutdown_wait.cpp against the existing local Linux libobs and Qt 6.10.2: 20/20 passed. This local sample does not reproduce the spontaneous CI failure.
A separate minimal fixture calls the current WaitForOutputToStop with a real signal handler and atomic active flag. The worker emits deactivate, pauses 100 ms to model preemption before the inactive store, then clears active. The helper returns during that gap: {"stopped":true,"active_at_return":true}, exit 1. Both stop/deactivate signals are registered; thread join and handler destruction complete cleanly. A 1-second timeout is supplied.
This deterministically confirms the inspected early-return mechanism under controlled scheduling, not that the exact pause occurred in historical CI. The subsequent no-stop failure remains unproven fallout. Existing test assertions were preserved; no serial scheduling or retry was introduced. Sources/scripts/raw results retained in this checkout at build_ci_audit/recording-wait-probe/.
Another real recurrence: master run 39084764880, OFF job 117551485445, failed the unchanged state assertions at lines 121 and 142. The Qt producer in that run passed; parent workflow failed this OFF test.
I validated the following suggested helper patch in an isolated local header copy for the existing issue owner to review. A deactivate signal no longer itself certifies inactivity; after that signal, a coalesced Qt timer rechecks the active state within the existing timeout while the UI event loop runs.
Controlled case
Original
Patched copy
deactivate, then delayed inactive store
returned stopped while active
returned stopped after inactive; UI timer fired
deactivate, but never becomes inactive
returned stopped while active
timed out with stopped=false; UI timer fired
Both original controls exit 1; both patched controls exit 0. The unchanged test_recording_shutdown_wait.cpp also passed 10 local invocations / 40 cases with the patched copy. Thread joins and handler cleanup occur before the probe exits, avoiding assertion-longjmp cleanup ambiguity.
--- a/frontend/widgets/RecordingShutdownWait.hpp+++ b/frontend/widgets/RecordingShutdownWait.hpp@@ -29,9 +29,10 @@
* A graceful stop of an active output signals "stop" while the output is
* still flushing its encoders, then "deactivate" when it is done, just
* before it reports inactive; an output that never began capturing signals
- * only "stop", and is already inactive. So the wait ends on "deactivate", or- * on "stop" once active() is false. libobs signals on its own threads: the- * callback only records the signal and queues the check to the UI thread. */+ * only "stop", and is already inactive. Signals trigger an active-state+ * check. After "deactivate", queued timer checks bridge the interval before+ * the output reports inactive, bounded by the same timeout. libobs signals+ * on its own threads; callbacks queue checks to the UI thread. */
inline bool WaitForOutputToStop(signal_handler_t *output_signals, uint64_t timeout_ms,
const std::function<bool()> &active)
{
@@ -41,11 +42,21 @@
std::atomic<bool> deactivated{false};
const std::function<bool()> *active = nullptr;
- bool Stopped() const { return deactivated.load() || !(*active)(); }+ bool retry_pending = false; /* UI thread only */++ bool Stopped() const { return !(*active)(); }
void Check()
{
if (Stopped()) {
loop.quit();
+ } else if (deactivated.load() && !retry_pending) {+ // deactivate can precede the inactive store on the output thread.+ // Recheck asynchronously without blocking the UI or outliving receiver.+ retry_pending = true;+ QTimer::singleShot(1, &receiver, [this]() {+ retry_pending = false;+ Check();+ });
}
}
void Queue()
This is a proposed private-helper change, not an applied production fix. Local QtCore/libobs results are not matched CI or real app-shutdown Tier 4 validation. The existing C/C++ tests and headers in the checkout were not edited. Probe, patch and raw logs remain in build_ci_audit/recording-order-patch/; its JSON contains the self-contained controlled probe source. Recording it here under the existing claim while completing #1286/#1362.
Another confirmed recurrence on master, after the cache report merged:
Run 39088389865, revision 129abf181feb3af6f97f206bdbdc213ed8812aeb, concluded failure.
ON job 117560479581: 296 registered CTests, one failing executable (test_recording_shutdown_wait). First case reports stopped=true after 220 ms while out.active is still true (line 121); following no-stop case returns true after 300 ms (line 142). The same failure signatures as earlier evidence remain.
OFF job 117560479638: 296 registered, zero failures. This asymmetry does not establish Rust causation; the helper/fixture ordering race is already reproduced independently with atomics and real signal handling.
Raw logs remain in build_ci_audit/master-1379-{on,off}-<job-id>.log. No test assertions, scheduling, source helper, or retries were changed. The previously offered patched-header experiment remains a proposed fix for the existing claimant, not a production fix. Cache-retirement #1380 passed its separate queue run; this failure does not implicate cache reclamation.
Coordinating a narrowly scoped post-#1342 regression correction in #1391: the wait can return on deactivate before active becomes false. The original asynchronous-wait task and ownership are preserved; this follow-up changes only the premature-success condition and bounded asynchronous recheck, with new tests and existing assertions unchanged. No competing rewrite or takeover of #1283.
Fixed by #1342 (merged). That PR used Refs, so the issue stayed open, but its body lists no remaining work. The follow-up early-return fix is #1392 (#1391).
Activity
zackees commentedon Oct 17, 2026
Claiming. Plan: wait for the output's stop signal asynchronously instead of a 10 ms polling loop on the UI thread; shutdown continues from the stop callback, with the existing timeout as a single-shot timer. RED: with a fake output that stops after N ms, shutdown completes while the UI event loop keeps processing events.
docs: Link PR #1342 in the features ledger line for #1283
test(frontend): recording shutdown wait must keep the UI event loop r…
frontend: recording shutdown waits for the stop signal instead of pol…
docs: Link PR #1342 in the features ledger line for #1283
frontend: Recording shutdown waits for the stop signal instead of pol…
zackees commentedon Oct 18, 2026
New live CI evidence from #1286 follow-up PR #1362, run 39081664635: both OFF job 117540316673 and ON job 117540316794 failed the unchanged
test_recording_shutdown_waitat line 121 (out.active.load() is not false). OFF also failed line 142 (stopped is not false) in the following no-stop case. Each suite registered 295 tests; the new startup diagnostics passed. No retry, skip, or assertion change performed.Observed OFF log:
stopped 1 after 220 ms, posted timer fired 1 (while waiting 1), then line 121; next caseno stop: returned 1 after 300 msthen line 142.Source inspection identifies a concrete race candidate in the already-merged #1342 implementation:
State::Stopped()returnsdeactivated.load() || !active(). The unchanged fixture signalsdeactivatebefore settingactive=false, so the UI thread can observe the signal and return before the active flag clears. The following-case failure may be fallout from cmocka's failing assertion bypassing the stack fixture's normal destruction; that part is an inference requiring reproduction. These are state assertions, not merely tight elapsed-time bounds; scheduling the test serially would not establish a correctness fix.Recording here under the existing fresh claim rather than starting competing source work. This is currently blocking #1362 CI; its build job succeeded. Raw job logs are retained locally under build_ci_audit/recovery-latest-{off,on}-.log.
zackees commentedon Oct 18, 2026
Follow-up local evidence (no production/source-test edits):
test_recording_shutdown_wait.cppagainst the existing local Linux libobs and Qt 6.10.2: 20/20 passed. This local sample does not reproduce the spontaneous CI failure.WaitForOutputToStopwith a real signal handler and atomic active flag. The worker emitsdeactivate, pauses 100 ms to model preemption before the inactive store, then clears active. The helper returns during that gap:{"stopped":true,"active_at_return":true}, exit 1. Both stop/deactivate signals are registered; thread join and handler destruction complete cleanly. A 1-second timeout is supplied.This deterministically confirms the inspected early-return mechanism under controlled scheduling, not that the exact pause occurred in historical CI. The subsequent no-stop failure remains unproven fallout. Existing test assertions were preserved; no serial scheduling or retry was introduced. Sources/scripts/raw results retained in this checkout at
build_ci_audit/recording-wait-probe/.zackees commentedon Oct 18, 2026
Another real recurrence: master run 39084764880, OFF job 117551485445, failed the unchanged state assertions at lines 121 and 142. The Qt producer in that run passed; parent workflow failed this OFF test.
I validated the following suggested helper patch in an isolated local header copy for the existing issue owner to review. A
deactivatesignal no longer itself certifies inactivity; after that signal, a coalesced Qt timer rechecks the active state within the existing timeout while the UI event loop runs.Both original controls exit 1; both patched controls exit 0. The unchanged
test_recording_shutdown_wait.cppalso passed 10 local invocations / 40 cases with the patched copy. Thread joins and handler cleanup occur before the probe exits, avoiding assertion-longjmp cleanup ambiguity.This is a proposed private-helper change, not an applied production fix. Local QtCore/libobs results are not matched CI or real app-shutdown Tier 4 validation. The existing C/C++ tests and headers in the checkout were not edited. Probe, patch and raw logs remain in
build_ci_audit/recording-order-patch/; its JSON contains the self-contained controlled probe source. Recording it here under the existing claim while completing #1286/#1362.zackees commentedon Oct 18, 2026
Another confirmed recurrence on master, after the cache report merged:
129abf181feb3af6f97f206bdbdc213ed8812aeb, concluded failure.test_recording_shutdown_wait). First case reports stopped=true after 220 ms whileout.activeis still true (line 121); following no-stop case returns true after 300 ms (line 142). The same failure signatures as earlier evidence remain.Raw logs remain in
build_ci_audit/master-1379-{on,off}-<job-id>.log. No test assertions, scheduling, source helper, or retries were changed. The previously offered patched-header experiment remains a proposed fix for the existing claimant, not a production fix. Cache-retirement #1380 passed its separate queue run; this failure does not implicate cache reclamation.zackees commentedon Oct 18, 2026
Coordinating a narrowly scoped post-#1342 regression correction in #1391: the wait can return on deactivate before active becomes false. The original asynchronous-wait task and ownership are preserved; this follow-up changes only the premature-success condition and bounded asynchronous recheck, with new tests and existing assertions unchanged. No competing rewrite or takeover of #1283.
zackees commentedon Oct 23, 2026
Fixed by #1342 (merged). That PR used
Refs, so the issue stayed open, but its body lists no remaining work. The follow-up early-return fix is #1392 (#1391).