You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
minvmd: the egress gate's hand-over and withdrawal should wait for the publish relays they admitted #3903
The publish ledger decides on a publish when it is admitted, but the relay writes it to the switch later, and nothing ties that write to what the gate decides in between. PR #3779 review left three cases open:
Settling a claim on a publish that has not been written yet (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, egress_gate.rs:2972). A HeldClaimed publish is noted before its write on purpose, so that a bind can never arrive before its note. As a result, an already-bound answer to the claim's expose can settle the claim while that publish is still being written and might never land.
A publish written after its row's withdrawal (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, :3360). revocation_pending is checked at decision time. A publish admitted before the withdrawal and written after the withdrawal's unexpose can still bind once the address is released, and the forward then serves the next box at that address. This affects every relayed publish (Noted, Held, HeldClaimed), not only the hand-over.
A relay's take-back lands on whatever record is there now (fix(minvmd): recognise the switch's whole answer for a listener it already holds #3779, :3303). note_unrelayed matches on listener and address. If the record is settled and a new one is filed for the same pair while a relay is still open, that relay's late refusal subtracts from the new record.
Proposal: keep a count of open relays per address and listener in the ledger. The count goes up at admission and down when the relay's write fails or its answer is read. Each relay also carries a token naming the record (or claim generation) it noted on. apply_waiting decides an already-bound answer only when no relay of the claim is open, and otherwise waits briefly for them to finish. revoke_box_forwards does not release an address while relays admitted at it are still open. note_unrelayed takes back a note only from the record its token names.
Tests: one in-crate test per case. Each drives the interleaving through relay_control with a stand-in switch, and each fails on the current code.
A fourth case, from the review of #3779 (egress_gate.rs, release_claim):
A refused final expose releases the attribution while a relayed publish is still open. When the host's last expose for a claim is refused, release_claim removes the applied entry for the listener. A publish of the claimed forward that was already relayed can still bind after that and return 200. Its success does not pass through admit_publish again, so nothing restores the entry, and a later withdrawal finds no applied entry to unexpose. The switch can then keep the forward live while the address goes to another box.
The proposal above covers it: release_claim keeps the attribution while relays admitted for that listener and address are open, and releases it when the last one fails or is answered. Test: a counted publish still open, the claim's final expose refused, then the publish binds; the withdrawal must still send the unexpose.
Activity
bryan-minimal commentedon Nov 30, 2026
A fourth case, from the review of #3779 (
egress_gate.rs,release_claim):release_claimremoves the applied entry for the listener. A publish of the claimed forward that was already relayed can still bind after that and return 200. Its success does not pass throughadmit_publishagain, so nothing restores the entry, and a later withdrawal finds no applied entry to unexpose. The switch can then keep the forward live while the address goes to another box.The proposal above covers it:
release_claimkeeps the attribution while relays admitted for that listener and address are open, and releases it when the last one fails or is answered. Test: a counted publish still open, the claim's final expose refused, then the publish binds; the withdrawal must still send the unexpose.