Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe C subscribe smoke client now stores all registration handles and completion state in Merge Risk: ⚪ Minimal · up to The C smoke client now completes callback teardown before normal exit, preventing callbacks from referencing expired stack state. No concrete current-head merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c91d7f630b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Placeholder to claim the quest branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The `rust -> c` leg was flaky, and 17bf0d9 papered over it with `_exit(0)` on the success path, blaming a glibc priority-protected-mutex assertion on openh264's worker threads at atexit. That diagnosis was wrong: the subscribe client never encodes, so no openh264 thread exists, and libmoq's runtime thread is harmless at exit. The real mechanism is a use-after-return of `ctx_t`. It lives on main's stack and is handed to four separate registrations as `user_data`. `moq_session_close` ends the session's status registration alone; `moq_origin_consume_announced`, `moq_consume_catalog` and `moq_consume_video` each keep the pointer until their own terminal (<= 0) callback. The old code closed the session and returned immediately, so `exit()`'s call frames landed on the same addresses `ctx` had occupied while the runtime thread was still calling `on_frame`, which locks `ctx->mu` and broadcasts `ctx->cv` right over the live exit path. Reproduced on Linux/glibc 2.36 (aarch64) with a relay, an ffmpeg H.264 publisher and the pre-17bf0d950 shape: 4 fatal signals in 100 runs. Under gdb the faulting process shows the `libmoq` thread inside `pthread_cond_broadcast(&ctx->cv)` from `on_frame`, on a condvar 16 bytes above main thread's live `sp`, while the main thread's PC is garbage. Whichever field the exit path clobbers first picks the symptom: a corrupted return address gives SIGSEGV/SIGBUS, a corrupted `pthread_mutex_t.__kind` routes an ordinary lock down glibc's TPP branch and gives the reported `__pthread_tpp_change_priority` assertion. So the success path now closes all four registrations, waits for all four terminals, and returns. That drain is also a standing assertion: a terminal callback that stops firing fails the leg deterministically instead of leaving a 4% flake. The failure paths keep `_exit` for the `user_data` lifetime reason from #2675. Measured on the same host, 200 runs each: pre-fix stack `ctx` 4/100 fatal; drained `ctx` 0/200; no registrations at all 0/200; the fixed client 0/200. `cpp/obs` was never affected: `moq_source_destroy` already refcounts every subscription and waits for the terminals. Closes #2676 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
c91d7f6 to
f35c94c
Compare
Summary
rust -> csmoke leg was flaky, and 17bf0d9 papered over it with_exit(0)on the success path, blaming a glibc priority-protected-mutex assertion on openh264's worker threads during atexit. That diagnosis was wrong on every count: the subscribe client never encodes, so no openh264 thread exists, and libmoq's runtime thread is harmless at exit.ctx_t. It lives onmain's stack and is handed to four separate registrations asuser_data.moq_session_closeends the session's status registration alone;moq_origin_consume_announced,moq_consume_catalogandmoq_consume_videoeach keep the pointer until their own terminal (<= 0) callback, exactly asmoq.hdocuments. The old code closed the session and returned immediately, soexit()'s call frames landed on the addressesctxhad occupied while libmoq's runtime thread was still callingon_frame, which locksctx->muand signalsctx->cvright over the live exit path.pthread_mutex_t.__kindroutes an ordinary lock down glibc's priority-protect branch with a garbage priority and gives the__pthread_tpp_change_priorityassertion this issue was filed for._exitfor theuser_datalifetime reason from fix(smoke): stop the C client returning from main while libmoq holds ctx #2675.rs/libmoq/src/test.rs; the client just did not follow it.cpp/obswas never affected:moq_source_destroyalready refcounts every subscription and waits for the terminals (and deliberately leaks rather than free early on timeout).Reproduction
Linux, Debian 12 / glibc 2.36, aarch64, in a container: a
moq-relayfrom this tree, an ffmpegtestsrcH.264 publisher throughmoq import avc3, and a subscriber built againstlibmoq.a. Each variant differs only in howmainends.moq_session_closethenreturn 0,ctxon the stackctxheap-allocated and leakedreturn 0(this PR's shape)moq_origin_createthenreturn 0subscribe.cThe heap variant is the control that rules out libmoq's teardown: same call sequence, same live runtime thread at
exit(), only the storage moved off the dying stack.Under gdb, a faulting run shows it directly:
The condvar being broadcast sits 16 bytes above the main thread's live stack pointer.
Public API changes
None.
Test plan
just checkandjust teston this tree.subscribe.cnow fails the leg deterministically withteardown never quiesced (frame=… catalog=… broadcast=… status=…)instead of leaving a ~4% flake. That is what a regression here would look like.Cross-package sync: no row applies.
rs/libmoq's C ABI is untouched, socpp/obs/srcanddoc/bin/obs.mdneed nothing.Closes #2676
🤖 Generated with Claude Code
(Written by Claude Opus 5)