Repository navigation
Fix "local track published for unknown sid" warning - #288
Merged
alan-george-lk merged 1 commit intoOct 15, 2026
Merged
Conversation
xianshijing-lk
approved these changes
Oct 15, 2026
alan-george-lk
marked this pull request as ready for review
October 15, 2026 03:07
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
stephen-derosa
approved these changes
Oct 15, 2026
alan-george-lk
deleted the
alan/bugfix-local-track-publication-ordering
branch
October 15, 2026 14:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have been noticing a log warning pop up a lot in tests/CI:
This resolves the issue. Changed integration tests to wait for track publish to ensure they're not dropped, as previously this warning meant the callbacks would be skipped as it was unknown.
Before the fix
LocalParticipant::publishTrack().fut.get().PublishTrackCallback.promise.set_value(publication).LocalTrackPublished.Room::onEvent()immediately searchespublished_tracks_by_sid_.local_track_published for unknown sidand drops the delegate event.A mutex prevents simultaneous unsafe access, but it does not guarantee that the application thread performs the write before the FFI thread performs the lookup.
What the PR changes
FfiClient::publishTrackAsync()now accepts anon_successfunction. Its event handler executes that function before satisfying the promise:LocalParticipantuses it to install all publication state directly on the FFI callback thread:After the fix
PublishTrackCallback.published_tracks_by_sid_.track->setPublication().LocalTrackPublished.Room::onEvent()finds the fully initialized publication and invokesonLocalTrackPublished.The important change is not merely “moving work to another thread.” It places the state update inside an existing ordering boundary: Rust guarantees that
LocalTrackPublishedis sent after the publish callback finishes.The integration tests now register a delegate and verify that both events are actually received:
LocalTrackPublishSidTest.PublishVideoTrackAssignsSidLocalTrackPublishSidTest.PublishAudioTrackAssignsSidThe condition variable also makes the tests safe whether the event arrives before or after the test begins waiting.
Fixes BOT-577