Skip to content

relay: fix reentrant wake-while-iterating in pending rendezvous tree - #652

Open
akash-a-n wants to merge 1 commit into
d18/rendezvous-timeoutfrom
fix/reentry-bug
Open

relay: fix reentrant wake-while-iterating in pending rendezvous tree#652
akash-a-n wants to merge 1 commit into
d18/rendezvous-timeoutfrom
fix/reentry-bug

Conversation

@akash-a-n

@akash-a-n akash-a-n commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

wakePendingRendezvousForTrack/wakePendingRendezvousSubtree called waiter->signal() while iterating waitersByTrack/children. TimedBaton:: signal() can resume the parked coroutine synchronously, re-entering erasePendingRendezvous() and mutating the same container the wake loop is still iterating over.

Split each wake path into two phases: walk/prune the tree and collect every waiter into a local vector (renaming wakePendingRendezvousSubtree to collectPendingRendezvousSubtree to reflect this), then signal the collected waiters only after all tree mutation is complete.

Add regression tests parking two waiters on the same track / on different tracks under the same namespace, asserting both resolve when woken by a single PUBLISH / PUBLISH_NAMESPACE.


This change is Reviewable

wakePendingRendezvousForTrack/wakePendingRendezvousSubtree called
waiter->signal() while iterating waitersByTrack/children. TimedBaton::
signal() can resume the parked coroutine synchronously, re-entering
erasePendingRendezvous() and mutating the same container the wake loop
is still iterating over.

Split each wake path into two phases: walk/prune the tree and collect
every waiter into a local vector (renaming wakePendingRendezvousSubtree
to collectPendingRendezvousSubtree to reflect this), then signal the
collected waiters only after all tree mutation is complete.

Add regression tests parking two waiters on the same track / on
different tracks under the same namespace, asserting both resolve when
woken by a single PUBLISH / PUBLISH_NAMESPACE.
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.

1 participant