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
test: test_screencast_portal_teardown hangs to its 20 s alarm now and then (Tier 2 ON, queue run 40076937467) #2099
The forked child runs run_scenario() with alarm(20), so a 20.03 s failure is the alarm firing: the scenario hung (a portal reply during destroy never completing, or a wait on the private D-Bus/PipeWire that never returned), not a crash. The child's stderr does not say where it waited.
Next step: rerun the test with --repeat until-fail:50 under the CI load profile (./unittest --lane tier2-linux or validate.sh --repeat 50 --tests test_screencast_portal_teardown) to reproduce, and log the scenario's phases so a hang shows its last step. Related: #246 (the original crash this test covers).
Places in run_scenario() that can block past the 20 s alarm (from reading the test, not reproduced):
g_test_dbus_up(): waits for the private dbus-daemon to start.
portal_thread: g_dbus_connection_new_for_address_sync and RequestName via g_dbus_connection_call_sync(..., -1, ...) (no timeout); the main thread waits on os_event_wait(portal.ready) with no timeout, so a stuck bus hangs the child.
GDBus calls inside the screencast portal code use the default 25 s timeout, longer than the alarm.
obs_wait_for_destroy_queue() and obs_shutdown() after the capture is destroyed.
The child's stderr shows nothing before the alarm, so the fix starts with logging the phase (PORTAL_TEST_VERBOSE already exists; a phase line before each of these would say which one).
Claiming: #2099. 1) reproduce with a repeated run of the test in the local Tier 2 container; 2) find which wait hangs; 3) fix the product code where it waits without a bound (the test itself is not edited, per policy). PR once reproduced.
Not reproduced locally: 100 runs idle and 400 under CPU load (both builds, run.sh --repeat) all passed, every run 1.8-1.95 s. So it's a rare race that sticks, not a slow wait. #2123 turns on the test's own PORTAL_TEST_VERBOSE in its registration so the next CI hang prints the last libobs step (or nothing, if it stuck in D-Bus/X setup). I'll keep this claim and take the fix once a failure log shows where.
Two more cases, both on PRs that don't touch linux-pipewire: reply_during_destroy_is_dropped failed at test_screencast_portal_teardown.c:330 in Tier 2 Linux on #2420 (run 40229295020, tests OFF) and on #2419 (run 40228403149, tests ON), minutes apart. Two in one hour suggests it's getting more frequent under load. I've re-run #2420.
The first hang with PORTAL_TEST_VERBOSE on (#2123): #2419, run 40228403149, attempt 1, job 121276394469 (Tier 2 Linux, tests ON, a 2-core runner). The child's last libobs lines, in order:
[pipewire] Screencast session created
[pipewire] Response to select source received
[pipewire] Asking for monitor and window
Source 'capture' destroyed
gs_enter_context: Null 'graphics' parameter
gs_texture_destroy: called while not in a graphics context (x18)
gs_leave_context: called while not in a graphics context
[portals] Request cancelled
Cleaning up pid 2895 (GTestDBus watcher, after the alarm)
After Request cancelled the child logs nothing until the alarm. obs_shutdown() logs its own lines, and none appear, so the child hung before obs_shutdown(). It was in the last iterate_main_loop(1500), in obs_wait_for_destroy_queue(), or in iterate_main_loop(200). The destroy thread had reached on_cancelled_cb() (the test's handler holds it there for 300 ms).
Two things in the code to check first. Neither is confirmed.
[portals] Request cancelled was logged from a thread that is not the test's main thread, because the handler only acts on it when !on_main. The only cancel on the destroy path is free_capture(), and that is meant to run on the main loop through the finish_destroy idle source. That points at either on_cancelled_cb running on another thread, from a g_cancellable_connect() on an already-cancelled cancellable or from GDBus's worker, or the idle source being dispatched off the main thread. Either way, the cancel then runs alongside the main thread's reply handling, which capture_hold()/finish_destroy() are meant to prevent.
Since GLib 2.80, g_cancellable_cancel() emits cancelled with the cancellable's lock held. A main-thread callback that touches the same cancellable (g_cancellable_connect/disconnect, or g_dbus_proxy_call with it) while the destroy thread is inside on_cancelled_cb → portal_signal_call_free() → g_dbus_connection_signal_unsubscribe() can block in either order. A block in GDBus would then last up to its 25 s default timeout, which is longer than the 20 s alarm.
A stack from the hung child would settle it. Before _exit, the test could have the alarm handler print gdb -batch -p <pid> -ex 'thread apply all bt', but the test can't be edited. The registration (as #2123 did for verbose) could instead run it under timeout -s QUIT 18 with core dumps on, and upload the core.
Another hit of test_screencast_portal_teardownreply_during_destroy_is_dropped (test_screencast_portal_teardown.c:330) on #2503's Rust Tier 2 Linux (tests OFF), run 40365468404. The PR doesn't touch screencast code. I've rerun the failed jobs.
Reproduction-recipe correction, from the #456 tick today: the filter this issue recommends matches no test.
validate.sh --repeat 50 --tests test_deinterlace_2x_field_order reaches CTest as ctest --repeat until-fail:50 -R 'test_deinterlace_2x_field_order' (unanchored, so that one does match) — but the anchored form used on 2026-10-27 and in this issue's text, '^test_deinterlace_2x_field_order$', matches nothing: CTest registers one test per case (test_deinterlace_2x_field_order_60i_into_60, _50i_into_50, _60i_into_50, _50i_into_30). A repeat run with the $ anchor prints No tests were found!!! and exits 0, i.e. it looks like a clean 50-rep pass while executing nothing.
On the #456 evidence, the flake there is load-induced and hits first_frame_linear_2x_unbuffered_60i_into_60 at about 1 in 15 loaded reps on this host (12 hogs / 16 cores, Tier 2 libobs build), while 60 idle reps in both modes all passed.
Unchanged in this issue: no new CI hang of reply_during_destroy_is_dropped has appeared — the last 40 workflow runs contain two failures, both verify_only app-lane dispatches, neither in a Tier 2 test job. The claim still waits on one hang that prints the #2553 teardown-phase lines.
Blocked: still waiting for one CI hang that prints the #2553 teardown-phase lines. New evidence this tick, all negative:
Loaded local runs: 12 CPU hogs on 16 cores, Tier 2 tests OFF and tests ON builds in the local container, ctest --repeat until-fail:60 -R test_screencast_portal_teardown each — 120/120 passed at 1.75-1.77 s per run. With the earlier 100 idle + 400 loaded runs (test: test_screencast_portal_teardown hangs to its 20 s alarm now and then (Tier 2 ON, queue run 40076937467) #2099 comment 2026-10-24), that is 620 local reps without a hang. The trigger needs something this host does not reproduce (2-core CI runner + its own load profile).
CI since linux-pipewire: Log the screencast portal teardown phases (#2099) #2553: the newest failing workflow runs (40815028760, 40811038629) both ran test_screencast_portal_teardown and passed (1.74 s in tests OFF); the failures were test_coreaudio_enum_alloc (PR #? CoreAudio allocation) and Fast Gate, unrelated to the portal. No hang has hit the instrument yet.
Plan unchanged: the first hang that prints [portals] Freeing a destroyed capture / Capture freed / Unloading names the phase, and the fix follows. I keep the claim.
Pool triage update: the teardown-phase instrumentation from #2553 has now caught the hang.
On merged #4733, run 43087239914, attempt 1, tests ON, job 130764201153, the test fails after 20.03 s with SIGALRM (14). Its last product messages are Freeing a destroyed capture followed by Request cancelled; neither Capture freed nor the portal unload entry appears. This directly answers the evidence request in the previous blocked comments. The same test later passes in attempt 3 (1.74 s) and attempt 4 (1.76 s) on the same PR head.
Seven-day audit, workflow creation window 2026-11-05 22:13:35 UTC through 2026-11-12 22:13:35 UTC:
Event
Enumerated workflows
Failed jobs (affected runs)
master push
450
2 (2)
PR
1,172
6 (6)
merge group
675
3 (3)
Counts are failed Linux Tier 2 job executions, with distinct affected workflow runs in parentheses. Denominators count all enumerated workflows, including scoped/skipped/cancelled runs; they are not a per-test flake probability. I checked every recorded attempt of non-successful or retried runs, including attempts hidden behind a final green result. The audit retained 1,196 candidate attempt/job snapshots and read all 170 failed/timed-out or started-and-cancelled Linux Tier 2 test-job logs, with no unavailable selected logs. Two master workflows were incomplete in the initial run-list snapshot; counts describe observed failures in the fetched evidence. Reruns of workflows created before the window are outside this cohort.
All 11 portal failures have SIGALRM 14 and the same two last teardown markers, without Capture freed. They span 7 OFF / 4 ON jobs. Complete failing-job index:
Root-cause hypothesis: cancellation/D-Bus lock inversion. At the inspected master 7604fcc39075:
screencast-portal.c.h:1041 calls g_cancellable_cancel() from free_capture().
Its synchronous portal.c.h:139-151 cancellation handler logs the last observed message, sends a D-Bus Request.Close, and unsubscribes the response signal. Both D-Bus operations can take the connection lock.
The shipped build installs GLib 2.88.0-1ubuntu0.1. In GLib 2.88.0 gcancellable.c, cancellation emits handlers while holding the cancellable mutex. In gdbusconnection.c, the reply worker holds the connection lock through send_message_with_reply_cleanup(), which calls g_cancellable_disconnect() and takes the cancellable mutex. These paths permit cancellable → connection against connection → cancellable.
This explains why an async D-Bus call inside the cancellation callback can still hang before the free-exit marker. It is a concrete source-level hypothesis, not a confirmed hung-process stack. The observed phase is after the PipeWire destroy calls and before completion of free_capture, so a PipeWire start/stop hang or a later obs_shutdown wait does not fit these particular logs.
Next focused step: capture both threads' stacks before the unchanged child's 20 s alarm, then move Request.Close/unsubscribe cleanup out of synchronous cancellation emission while retaining capture/request state until deferred cleanup finishes. A focused new regression case should force reply cleanup to overlap cancellation. Do not replace the signal disconnect with g_cancellable_disconnect() inside its own cancelled handler: GLib explicitly documents that as a deadlock.
No local reproduction attempted: this host had load averages 35.56/29.67/26.40 on 16 logical CPUs. No C tests, workflows, public headers, or product code were edited; no PR or push.
Activity
zackees commentedon Oct 24, 2026
Places in
run_scenario()that can block past the 20 s alarm (from reading the test, not reproduced):g_test_dbus_up(): waits for the private dbus-daemon to start.portal_thread:g_dbus_connection_new_for_address_syncandRequestNameviag_dbus_connection_call_sync(..., -1, ...)(no timeout); the main thread waits onos_event_wait(portal.ready)with no timeout, so a stuck bus hangs the child.obs_wait_for_destroy_queue()andobs_shutdown()after the capture is destroyed.The child's stderr shows nothing before the alarm, so the fix starts with logging the phase (PORTAL_TEST_VERBOSE already exists; a phase line before each of these would say which one).
zackees commentedon Oct 24, 2026
Claiming: #2099. 1) reproduce with a repeated run of the test in the local Tier 2 container; 2) find which wait hangs; 3) fix the product code where it waits without a bound (the test itself is not edited, per policy). PR once reproduced.
zackees commentedon Oct 24, 2026
Not reproduced locally: 100 runs idle and 400 under CPU load (both builds,
run.sh --repeat) all passed, every run 1.8-1.95 s. So it's a rare race that sticks, not a slow wait. #2123 turns on the test's own PORTAL_TEST_VERBOSE in its registration so the next CI hang prints the last libobs step (or nothing, if it stuck in D-Bus/X setup). I'll keep this claim and take the fix once a failure log shows where.test: run the screencast portal teardown test verbosely, so a hang sh…
zackees commentedon Oct 25, 2026
Two more cases, both on PRs that don't touch linux-pipewire:
reply_during_destroy_is_droppedfailed attest_screencast_portal_teardown.c:330in Tier 2 Linux on #2420 (run 40229295020, tests OFF) and on #2419 (run 40228403149, tests ON), minutes apart. Two in one hour suggests it's getting more frequent under load. I've re-run #2420.zackees commentedon Oct 26, 2026
The first hang with
PORTAL_TEST_VERBOSEon (#2123): #2419, run 40228403149, attempt 1, job 121276394469 (Tier 2 Linux, tests ON, a 2-core runner). The child's last libobs lines, in order:After
Request cancelledthe child logs nothing until the alarm.obs_shutdown()logs its own lines, and none appear, so the child hung beforeobs_shutdown(). It was in the lastiterate_main_loop(1500), inobs_wait_for_destroy_queue(), or initerate_main_loop(200). The destroy thread had reachedon_cancelled_cb()(the test's handler holds it there for 300 ms).Two things in the code to check first. Neither is confirmed.
[portals] Request cancelledwas logged from a thread that is not the test's main thread, because the handler only acts on it when!on_main. The only cancel on the destroy path isfree_capture(), and that is meant to run on the main loop through thefinish_destroyidle source. That points at eitheron_cancelled_cbrunning on another thread, from ag_cancellable_connect()on an already-cancelled cancellable or from GDBus's worker, or the idle source being dispatched off the main thread. Either way, the cancel then runs alongside the main thread's reply handling, whichcapture_hold()/finish_destroy()are meant to prevent.g_cancellable_cancel()emitscancelledwith the cancellable's lock held. A main-thread callback that touches the same cancellable (g_cancellable_connect/disconnect, org_dbus_proxy_callwith it) while the destroy thread is insideon_cancelled_cb→portal_signal_call_free()→g_dbus_connection_signal_unsubscribe()can block in either order. A block in GDBus would then last up to its 25 s default timeout, which is longer than the 20 s alarm.A stack from the hung child would settle it. Before
_exit, the test could have the alarm handler printgdb -batch -p <pid> -ex 'thread apply all bt', but the test can't be edited. The registration (as #2123 did for verbose) could instead run it undertimeout -s QUIT 18with core dumps on, and upload the core.zackees commentedon Oct 26, 2026
Another hit of
test_screencast_portal_teardownreply_during_destroy_is_dropped(test_screencast_portal_teardown.c:330) on #2503's Rust Tier 2 Linux (tests OFF), run 40365468404. The PR doesn't touch screencast code. I've rerun the failed jobs.4 remaining items
zackees commentedon Oct 29, 2026
Reproduction-recipe correction, from the #456 tick today: the filter this issue recommends matches no test.
validate.sh --repeat 50 --tests test_deinterlace_2x_field_orderreaches CTest asctest --repeat until-fail:50 -R 'test_deinterlace_2x_field_order'(unanchored, so that one does match) — but the anchored form used on 2026-10-27 and in this issue's text,'^test_deinterlace_2x_field_order$', matches nothing: CTest registers one test per case (test_deinterlace_2x_field_order_60i_into_60,_50i_into_50,_60i_into_50,_50i_into_30). A repeat run with the$anchor printsNo tests were found!!!and exits 0, i.e. it looks like a clean 50-rep pass while executing nothing.On the #456 evidence, the flake there is load-induced and hits
first_frame_linear_2x_unbuffered_60i_into_60at about 1 in 15 loaded reps on this host (12 hogs / 16 cores, Tier 2libobsbuild), while 60 idle reps in both modes all passed.Unchanged in this issue: no new CI hang of
reply_during_destroy_is_droppedhas appeared — the last 40 workflow runs contain two failures, bothverify_onlyapp-lane dispatches, neither in a Tier 2 test job. The claim still waits on one hang that prints the#2553teardown-phase lines.zackees commentedon Oct 29, 2026
Claiming: #2099 (the intermittent 20 s alarm hang in
test_screencast_portal_teardown).Plan, one PR:
Expect the first PR this tick.
zackees commentedon Oct 29, 2026
Blocked: still waiting for one CI hang that prints the
#2553teardown-phase lines. New evidence this tick, all negative:tests OFFandtests ONbuilds in the local container,ctest --repeat until-fail:60 -R test_screencast_portal_teardowneach — 120/120 passed at 1.75-1.77 s per run. With the earlier 100 idle + 400 loaded runs (test: test_screencast_portal_teardown hangs to its 20 s alarm now and then (Tier 2 ON, queue run 40076937467) #2099 comment 2026-10-24), that is 620 local reps without a hang. The trigger needs something this host does not reproduce (2-core CI runner + its own load profile).40815028760,40811038629) both rantest_screencast_portal_teardownand passed (1.74 s intests OFF); the failures weretest_coreaudio_enum_alloc(PR #? CoreAudio allocation) and Fast Gate, unrelated to the portal. No hang has hit the instrument yet.Plan unchanged: the first hang that prints
[portals] Freeing a destroyed capture/Capture freed/Unloadingnames the phase, and the fix follows. I keep the claim.linux-pipewire: Log the screencast portal teardown phases (obs-rust#2099
zackees commentedon Nov 12, 2026
Pool triage update: the teardown-phase instrumentation from #2553 has now caught the hang.
On merged #4733, run 43087239914, attempt 1, tests ON, job 130764201153, the test fails after 20.03 s with SIGALRM (14). Its last product messages are
Freeing a destroyed capturefollowed byRequest cancelled; neitherCapture freednor the portal unload entry appears. This directly answers the evidence request in the previous blocked comments. The same test later passes in attempt 3 (1.74 s) and attempt 4 (1.76 s) on the same PR head.Seven-day audit, workflow creation window 2026-11-05 22:13:35 UTC through 2026-11-12 22:13:35 UTC:
Counts are failed Linux Tier 2 job executions, with distinct affected workflow runs in parentheses. Denominators count all enumerated workflows, including scoped/skipped/cancelled runs; they are not a per-test flake probability. I checked every recorded attempt of non-successful or retried runs, including attempts hidden behind a final green result. The audit retained 1,196 candidate attempt/job snapshots and read all 170 failed/timed-out or started-and-cancelled Linux Tier 2 test-job logs, with no unavailable selected logs. Two master workflows were incomplete in the initial run-list snapshot; counts describe observed failures in the fetched evidence. Reruns of workflows created before the window are outside this cohort.
All 11 portal failures have SIGALRM 14 and the same two last teardown markers, without
Capture freed. They span 7 OFF / 4 ON jobs. Complete failing-job index:Root-cause hypothesis: cancellation/D-Bus lock inversion. At the inspected master
7604fcc39075:screencast-portal.c.h:1041callsg_cancellable_cancel()fromfree_capture().portal.c.h:139-151cancellation handler logs the last observed message, sends a D-BusRequest.Close, and unsubscribes the response signal. Both D-Bus operations can take the connection lock.2.88.0-1ubuntu0.1. In GLib 2.88.0 gcancellable.c, cancellation emits handlers while holding the cancellable mutex. In gdbusconnection.c, the reply worker holds the connection lock throughsend_message_with_reply_cleanup(), which callsg_cancellable_disconnect()and takes the cancellable mutex. These paths permitcancellable → connectionagainstconnection → cancellable.This explains why an async D-Bus call inside the cancellation callback can still hang before the free-exit marker. It is a concrete source-level hypothesis, not a confirmed hung-process stack. The observed phase is after the PipeWire destroy calls and before completion of
free_capture, so a PipeWire start/stop hang or a laterobs_shutdownwait does not fit these particular logs.Next focused step: capture both threads' stacks before the unchanged child's 20 s alarm, then move Request.Close/unsubscribe cleanup out of synchronous cancellation emission while retaining capture/request state until deferred cleanup finishes. A focused new regression case should force reply cleanup to overlap cancellation. Do not replace the signal disconnect with
g_cancellable_disconnect()inside its own cancelled handler: GLib explicitly documents that as a deadlock.No local reproduction attempted: this host had load averages 35.56/29.67/26.40 on 16 logical CPUs. No C tests, workflows, public headers, or product code were edited; no PR or push.
rdoupe commentedon Nov 23, 2026
Seen again on the master push of cb0d23e (#5523, a CI-only change): https://github.com/obs-rust/obs-studio/actions/runs/45244045417/job/137946925694 —
reply_during_destroy_is_droppedhit the 20 s alarm (signal 14) right after[portals] Request cancelled. Reran the failed job.