fleetd #546: widen Injector's delivery catch to Throwable #549
Reference in New Issue
Block a user
Delete Branch "worker/546-injector-redelivery-d810ad-7"
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 #546.
PR #543 (fleetd #538) widened StatusPoller's per-target catch to Throwable so the polling loop survives an Error instead of dying. That fix made a second-order defect reachable: Injector.java's own delivery catch (Injector.java:391) only caught RuntimeException, so a non-RuntimeException throwable (e.g. NoClassDefFoundError, #413) escaping the herdr send at :383 left the poisoned message QUEUED at the head of the target's queue (Injector.java:378 peeks, not polls). Once #543 let the poller survive and come back round, the next onStatus round would re-enter the same try and send the same text again -- the same brief typed into the member's pane twice.
Change
Widen Injector.java:391's catch from RuntimeException to Throwable, matching #543 one layer down. The handler body was already correct (drop the poisoned message, mark NOT_DELIVERED, surface the error) -- it was scoped one class too narrow.
sendError's declared type widens from RuntimeException to Throwable to keep this compiling. Its only consumer is CompletableFuture.completeExceptionally(Throwable), which already accepts Throwable, so no other caller-visible behavior changes. The ordinary HerdrException/RuntimeException path (the only path reachable before #543) is unchanged.
I looked at Injector.java's other catch clause (the resubmit nudge, now at :500 after my added comment lines) -- it has the same RuntimeException-only shape, but its consequence is different: it doesn't touch queue state, so an escaping Error there just skips one debug log and one Enter nudge for that round (the next round retries), not a duplicate send. Left unchanged per the ticket's "one change, one ticket."
Tests (added to InjectorTest.java)
Verification