Skip to content

relay: hop cross-exec handle teardown to the owning exec#449

Merged
afrind merged 1 commit into
mainfrom
fix/tsan-lf-publish-done
Jun 26, 2026
Merged

relay: hop cross-exec handle teardown to the owning exec#449
afrind merged 1 commit into
mainfrom
fix/tsan-lf-publish-done

Conversation

@afrind

@afrind afrind commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The reciprocal peer SubscribeNamespaceHandle was acquired via a direct session->subscribeNamespace() and stored raw, so peerSubNsHandles_.erase() destroyed it on relayExec_ — running its teardown (isClosed() read + control RST) on the wrong thread while the peer session closed on its own io exec (TSAN-confirmed data race on MoQSession).

Acquire it through maybeWrapPublisher so the handle is a CrossExecSubscribeNamespaceHandle bound to the session's exec, and give every cross-exec wrapper in PublisherCrossExecFilter a destructor that hops the inner handle's destruction to that exec — so destructor-driven teardown is exec-correct, not just the explicit unsubscribe/cancel calls.


This change is Reviewable

The reciprocal peer SubscribeNamespaceHandle was acquired via a direct
session->subscribeNamespace() and stored raw, so peerSubNsHandles_.erase()
destroyed it on relayExec_ — running its teardown (isClosed() read + control
RST) on the wrong thread while the peer session closed on its own io exec
(TSAN-confirmed data race on MoQSession).

Acquire it through maybeWrapPublisher so the handle is a
CrossExecSubscribeNamespaceHandle bound to the session's exec, and give every
cross-exec wrapper in PublisherCrossExecFilter a destructor that hops the inner
handle's destruction to that exec — so destructor-driven teardown is
exec-correct, not just the explicit unsubscribe/cancel calls.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@afrind afrind force-pushed the fix/tsan-lf-publish-done branch from 261964b to 19998ed Compare June 25, 2026 23:23

@gmarzot gmarzot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarzot reviewed 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on afrind).

@afrind afrind merged commit 430e536 into main Jun 26, 2026
16 checks passed
@afrind afrind deleted the fix/tsan-lf-publish-done branch June 26, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants