Repository navigation
state_exec: a closing group's late queue and forwarding addresses replace the poster's wait (S2b.R3) - #1561
Merged
Conversation
…lace the poster's wait (S2b.R3) The skeptic's K-1: a group in its teardown never waited for another closed home, so a receiving group torn down with its home sent its answers and unsubscribes ahead of the home's forward. The result was a duplicate broadcast delivery, a leaked tracker, and a dead process's record that kept the router on. Making that teardown wait instead would deadlock two homes torn down at once. - A closed handle takes router entries into a late queue until it is done. The teardown forwards each key's entries to one target, the key's home among the groups open when its first entry goes. It forwards the late entries until none are left, then unregisters under the handle's lock and keeps each key's target as a forwarding address. A refused poster follows that address at once. A teardown's own forwards go to open groups only, so nothing comes back to it except a deliver's requeue. - The seal is a backstop for posters as fast as the forward. When a round's batch doesn't shrink, reaches the ingress cap, or 4 rounds have gone, only another teardown's forward is still taken, and any other poster waits for done, a bounded wait. - K-2: a teardown's queued and late sends are forwarded only for keys it homed. - K-3: once its teardown begins, post_message goes through the group's handle, keeping a host's order. A post that would die with the group dies now, counted. - K-4: the constructor's guard spans the whole constructor. - K-5: the skeptic's probes are adopted. - The R3 review's fixes: - seal on a batch that doesn't shrink or reaches the cap; - try_post's refusal reasons; - address hops don't count against the 16 re-resolutions; - closed-handle posts take only the late-queue mutex, and done is atomic. - The router model has the late queue in place of the wait, and the skeptic's teardown-no-wait mutation finds the three findings. The router-model job's timeout is raised to 90 minutes.
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.
S2b.R3 fixes the skeptic's findings (K-1 to K-6) on S2b's R2 fixes, as a follow-up to #1524 and #1543. A closing group's handle now has a late queue, the teardown leaves per-key forwarding addresses, and a seal stops posters if the queue keeps filling. Together these replace the router's poster wait.
K-1 (major): overlapping teardowns
A group in its teardown never waited for another closed home (
post_routed'smay_wait). When a receiving group and its home tore down together, two things went wrong:takenreached the new home before the old home'sadopt. A message another receiver had taken was queued again, and its tracker leaked.Waiting as the frozen text said would have deadlocked two homes tearing down at once, each holding an entry for the other.
The new rule is in
exec_router.h("Teardown and rehoming") and td 4.6:group_ref::post_message,post_controlandvisitare refused once closed.new_home_of), and then wherever that entry went. The order stays pending, records, trackers, queue, followed by the late entries until none are left.group_ref::forwarded), which it follows however long the chain;home_of, except that a teardown's own forward goes tonew_home_of, so its targets are open groups only;new_home_of.hostflag and the self-exemption (C-m1) are gone. So isexec_router.h's documented gap where a key's home changes twice while a broadcast is out: answers follow the old home's address.Minors
post_messagegoes through its handle as a send. That means its ingress before the close, the late queue after, or the forwarding address once done. So it no longer sits in the dying ingress, and a host's posts keep their order whichever entry point they use. Posts that would have died in the queue ('#' keys, an island's own keys) die at once, counted, and return true as before.exec_group's constructor.Review
A read-only review (R3-1 to R3-9) found nothing major on a strict reading. Fixed:
post_message's order across the close;try_postreports why a post was refused, so a cap refusal is never retried past the cap;doneis atomic;Recorded without a code change: a throw in
leave_routerdrops the late queue (counted), and address chains keep their targets alive while an old handle is held.Tests
RouterR3cases. Seven of the first twelve failed at master; the rest guard against regressions. The new ones cover the seal, a host posting through a teardown (20000 posts kept in FIFO order), a chain of 20 teardowns, and an island's post during its teardown. All are added toSAN_REQUIRED_S2B.AnAnswerWaitsForItsClosedHomesForwardbecomesAnAnswerToAClosedHomeGoesAfterItsForward, andATeardownNeverWaitsOnItselfandADeliverAClosedReceiverRefusesIsStaleAtOnceare updated to the new rule.tools/locks_model/router.py) models the late queue in place of the poster wait.test_router.pypasses 10 tests.teardown-no-waitmutation finds duplicate, stale-record and tracker-leak on all four configurations.locks-deep's router-model timeout goes from 45 to 90 minutes.Local results (Windows, MSVC Release, cvcpkg prefix; at 1302cfb before the master merge)
CVC_EXEC_SLICE_STEPS=256give identical results. All pass: router 81, stress 2, exec_pool 87, groups 33, async 143, intrinsics 181, async_calls 83, priority 40, scheduler 200, exceptions 26, data_steps 54, hazards 12, integration 105, stackless 89, app 123, ariadne_host 54, ariadne_runtime 368, coordinator 76, locks 221.-R pycvc, 68 tests). Every exec_pool and state_exec test passes. Three tests fail on this box for reasons unrelated to this change, and are left for CI's configuration:volume_grid_contours: this build has nocvc::planar.physics: it needs a gtest binary that wasn't built here.net: this box doesn't raise on a port that's already taken.pycvc_state_exec_locksPR08 fails at slice 256, as it has since S2b.0, because it assumes one step per pick.