fleetd #553: register the rendezvous waiter in onStatus's finally backstop #557
Reference in New Issue
Block a user
Delete Branch "worker/553-onstatus-completion-leak-0da881-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes fleetd #553.
The uncommitted try/finally around onStatus's post-monitor region (from a previous, released worker session) completed sent.delivered() when an earlier listener threw, but never registered sent.token().waiter() -- that waiter is registered only by turnListener.onDelivered(), inside the very if (sent != null) block the finally backstops. That converted a hang into a hang WITH a success receipt: the caller was told its send landed, then waited out its full timeout for an answer that could never resolve.
The finally now does the block's whole job on the unhandled path: it calls onDelivered() (only when sendError == null) before completing the future, wrapped in its own try/catch(Throwable) so a failure there cannot mask the original throwable, which must still escape onStatus to StatusPoller's catch (Throwable). A sentHandled flag records the INTENT to handle before any side effect (set true at the start of the normal block, not after) so a throw partway through onDelivered cannot trigger a second, late captureBaseline that would permanently suppress the turn's completion (CompletionResolver's baseline-equals-tail suppression at :364-369).
Also removed a leftover duplicated forget.accept(target) call (with a stray 'MUTATION-TEST-3' comment) in the notReady block -- residue from the previous worker's own mutation testing that was not fully reverted.
Tests: two new acceptance tests added --
Both mutation-tested (line-anchored sed, pristine anchor 1->0, red with the test's own message, restored to byte-identical shasum -a 256, green again).
Full build: mvn clean install -- BUILD SUCCESS, Tests run: 1728, Failures: 0, Errors: 0, Skipped: 0.