Skip to content

test: wait for the tick before reading a transition child's weak ref (Fixes #4680) - #5423

Merged
rdoupe merged 1 commit into
masterfrom
fix/4680-transition-slot-wait
Nov 22, 2026
Merged

rdoupe merged 1 commit into
masterfrom
fix/4680-transition-slot-wait

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #4680. Approved on the issue: add only the wait, change and remove no assertion, and drop the test from known-flaky.txt.

child_alive() read a child's weak reference right after obs_transition_clear() (or the transition's release) dropped the transition's own references. The video thread's tick_sources() keeps its own reference on every source while it ticks, so for a moment the weak reference still gave back the child. This happens in the C reference too; it is how upstream libobs behaves, not a port bug. child_alive() now calls obs_wait_for_destroy_queue() first. Since #5407 that waits for a video tick even with no audio running, the same wait used for #4800.

RED (C reference, test unchanged)

Two local-only delays, neither committed: os_sleep_ms(30) in tick_sources() right after it takes its source references (libobs/obs-video.c.h), and os_sleep_ms(40) in clear_empties_both_slots before obs_transition_clear().

OBS_CTEST_JOBS=10 uv run --no-project rust/tools/linux-validate/run.py --wait --repeat 3 --tests test_source_transition_slots
== [OFF] tests load /build/tree/libobs-c-reference/libobs.so.30
[  ERROR   ] --- child_alive(0) is not false
[   LINE   ] --- /ro/test/cmocka/test_source_transition_slots.c:246: error: Failure!
	908 - test_source_transition_slots (Failed)

(Line 246 is line 245 plus the delay line.) The 30 ms tick delay also fails some timing-bound tests (deinterlace field order, async rotation). They fail the same way with and without this fix.

GREEN

Same two delays plus this change, same command:

== [OFF] tests load /build/tree/libobs-c-reference/libobs.so.30
868/1073 Test  #908: test_source_transition_slots ....   Passed    0.67 sec

Without the delays, both builds, full suite then 100 repeats:

OBS_CTEST_JOBS=10 uv run --no-project rust/tools/linux-validate/run.py --wait --repeat 100 --tests test_source_transition_slots
== [OFF] tests load /build/tree/libobs-c-reference/libobs.so.30
100% tests passed, 0 tests failed out of 1073
== [OFF] ctest --repeat until-fail:100 -R test_source_transition_slots
100% tests passed, 0 tests failed out of 1
== [ON] tests load /build/tree/libobs/libobs.so.30
100% tests passed, 0 tests failed out of 1073
== [ON] ctest --repeat until-fail:100 -R test_source_transition_slots
100% tests passed, 0 tests failed out of 1

./lint passes.

🤖 Generated with Claude Code

…ixes #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 <noreply@anthropic.com>
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"}}
@github-actions github-actions Bot added the claim-conflict A PR closing reference conflicts with the issue claim label Nov 21, 2026
@github-actions

Copy link
Copy Markdown

Claim conflict: keep this PR out of the merge queue until resolved.

@zackees

zackees commented Nov 22, 2026

Copy link
Copy Markdown
Member

Coordinator: the claim check flagged #4800 as a closing reference, because GitHub reads "fixed #4800" in the body as a keyword. I reworded it to "the same wait used for #4800". No other change. The claim check reruns on the edit.

@github-actions github-actions Bot removed the claim-conflict A PR closing reference conflicts with the issue claim label Nov 22, 2026
@rdoupe
rdoupe marked this pull request as ready for review November 22, 2026 00:20
@rdoupe
rdoupe requested a review from zackees as a code owner November 22, 2026 00:20
@rdoupe
rdoupe added this pull request to the merge queue Nov 22, 2026
Merged via the queue into master with commit ea7fef2 Nov 22, 2026
47 of 48 checks passed
@rdoupe
rdoupe deleted the fix/4680-transition-slot-wait branch November 22, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Flaky Tier 2: test_source_transition_slots clear_empties_both_slots child_alive under load

2 participants