From d2efe3321f06d2dbfef25f12b2adf3b40f53dbb6 Mon Sep 17 00:00:00 2001 From: Ryan Doupe Date: Sat, 21 Nov 2026 18:38:08 -0500 Subject: [PATCH] test: wait for the tick before reading a transition child's weak ref (Fixes #4680) clear_empties_both_slots, and the release checks after it, read a child's weak reference right after the transition dropped its own references. The video thread's tick_sources() holds a reference on every source while it ticks, so for a moment the weak reference still yields the child, in the C reference as much as in hybrid libobs. child_alive() now waits for the destroy queue, which waits a video tick, before it reads the weak reference. No assertion changes. The test leaves known-flaky.txt. Co-Authored-By: Claude Opus 5.5 Ci-Attestation: {"at":1795304365,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":62,"stamp":"55a56e6d5f19c5419bc76a6fb41c4912","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304365,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":62,"stamp":"debba485abded9cd5170899fa4556d82","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304365,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":62,"stamp":"11cdcd9d52004202ddf9d21cbe59e57e","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304365,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":62,"stamp":"c77fdcaa9906373e023354a67127de81","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"general/all/client-lint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"e5de443586137046280a8a79631d8ac3","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304365,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":62,"stamp":"029de4dc69bb75597b107aad3d4d2119","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"58bc1175d37e12e14f3f88d55a36e9a7","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"1462995ae31575e9a090da7621cda315","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"59b33d55f430541102faa4bdfd9f8666","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"f5abe306e39f11fc5ad67bc089b082d9","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"20ee1c20cd66fdc0c5b9c5c81eb96874","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"ea2eef36c07bfd13083c5b4c1e4eaa19","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"1f970a38ccceceac6eb9dec4d288befc","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"82c65e5e1a29471505557adbc49c19c0","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"365c0e0cf62590f481e3604e58a5cb01","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"79eb920491b21c725e93e0dc70365de9","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"6351dbdf41c697a1d229fd863177eeaa","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304302,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"f089c493d3f9daeb469d75e67aafeaf864ec955661e74b71079464de87e4bc63","lane":"client-lint","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":10,"stamp":"6a96256539a3f516855afcc7b027fa4c","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Ci-Attestation: {"at":1795304620,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"83d18f14c6b1183d10f8c95e36bf13bfaa7165a4b90d1a8c05e4a84c383c5fd5","lane":"client-test-x86_64-unknown-linux-gnu","parents":["a98b199d3fc02ef274f861915dea5aecbdd448f0"],"secs":254,"stamp":"2566aac9c4baa0007fa0fd669178196a","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c","v":1,"via":"run"} Client-Checks: {"checks":{"base":"a98b199d3fc02ef274f861915dea5aecbdd448f0","coverage":"all-tracked-applicable-files","diff":["test/cmocka/known-flaky.txt","test/cmocka/test_source_transition_slots.c"],"head":"bb76d1872744bcec596c147a19231d30b3b94230","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"e8576160b41d297ecc90fb3f53c471870f28f9d38d7a4563feca566ccf298285","tree":"a419528ebd54eb2dc5f54b11d97d78fb5c1c0c1c"}} --- test/cmocka/known-flaky.txt | 1 - test/cmocka/test_source_transition_slots.c | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cmocka/known-flaky.txt b/test/cmocka/known-flaky.txt index a51586bc2a..1309178fe7 100644 --- a/test/cmocka/known-flaky.txt +++ b/test/cmocka/known-flaky.txt @@ -2,4 +2,3 @@ # Full-name matches only. Remove entries when their tracking issue is resolved. ^test_frontend_screenshot_srgb$ #3960 I010 and I210 orange cases intermittently sample a black program frame after a correct screenshot ^test_pulse_default_follow_pipewire$ #4944 default_output_unplugged still flakes after private-daemon serialization -^test_source_transition_slots$ #4680 clear assumes immediate weak expiry while the video tick may still own a reference (1/972 C reference under CPU-pinned stress) diff --git a/test/cmocka/test_source_transition_slots.c b/test/cmocka/test_source_transition_slots.c index 4e5255ba24..1d7c09e9ec 100644 --- a/test/cmocka/test_source_transition_slots.c +++ b/test/cmocka/test_source_transition_slots.c @@ -188,9 +188,12 @@ static void drop_child(size_t i) live.child[i] = NULL; } -/* Whether anything still holds a reference on child i. */ +/* Whether anything still holds a reference on child i. A video tick holds + * its own reference on every source while it ticks, so wait for the destroy + * queue (which waits a tick) before reading the weak reference (#4680). */ static bool child_alive(size_t i) { + obs_wait_for_destroy_queue(); obs_source_t *s = obs_weak_source_get_source(live.weak[i]); obs_source_release(s); return s != NULL;