fleetd #345: test timeout cancellation race #349

Closed
agent wants to merge 0 commits from worker/fd345-490d0f-3 into main
Member

fleetd #345

Change

Uses mechanism 1: a package-private, test-only timeout hook in MessageService. The hook runs after the first incomplete completion read and before Injector.cancel takes the target monitor. This matches the existing race-hook pattern and tests the caller wiring against the real final Injector.

What the test does not prove

The test does not prove this exact interleaving occurs by itself under production timing. It forces the interleaving through the hook. It proves that the timeout caller uses Cancellation.DELIVERED when the interleaving occurs.

Mutation proof

I copied MessageService.java aside, replaced the assignment from injector.cancel with a bare injector.cancel(delivery); call, and ran the full suite. It failed as required: MessageServiceTest.sendTimeoutUsesCancellationDeliveredWhenPickupWinsTheRace at MessageServiceTest.java:429, expected TIMED_OUT_WORKING but was TIMED_OUT_QUEUED. Maven reported: Tests run: 1364, Failures: 1, Errors: 0, Skipped: 0 and BUILD FAILURE. I restored the production line.

Final check

Ran /Users/dai.ha/Softwares/apache-maven/bin/mvn clean install in fleetd without a pipe. Result: Tests run: 1364, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS.

Files changed:

  • fleetd/src/main/java/dev/ltms/fleet/msg/MessageService.java
  • fleetd/src/test/java/dev/ltms/fleet/msg/MessageServiceTest.java
## fleetd #345 ### Change Uses mechanism 1: a package-private, test-only timeout hook in MessageService. The hook runs after the first incomplete completion read and before Injector.cancel takes the target monitor. This matches the existing race-hook pattern and tests the caller wiring against the real final Injector. ### What the test does not prove The test does not prove this exact interleaving occurs by itself under production timing. It forces the interleaving through the hook. It proves that the timeout caller uses Cancellation.DELIVERED when the interleaving occurs. ### Mutation proof I copied MessageService.java aside, replaced the assignment from injector.cancel with a bare injector.cancel(delivery); call, and ran the full suite. It failed as required: MessageServiceTest.sendTimeoutUsesCancellationDeliveredWhenPickupWinsTheRace at MessageServiceTest.java:429, expected TIMED_OUT_WORKING but was TIMED_OUT_QUEUED. Maven reported: Tests run: 1364, Failures: 1, Errors: 0, Skipped: 0 and BUILD FAILURE. I restored the production line. ### Final check Ran /Users/dai.ha/Softwares/apache-maven/bin/mvn clean install in fleetd without a pipe. Result: Tests run: 1364, Failures: 0, Errors: 0, Skipped: 0; BUILD SUCCESS. Files changed: - fleetd/src/main/java/dev/ltms/fleet/msg/MessageService.java - fleetd/src/test/java/dev/ltms/fleet/msg/MessageServiceTest.java
agent added 1 commit 2026-09-04 11:31:37 +02:00
fleetd #345: test timeout cancellation race
CI / contract (pull_request) Successful in 1m28s
CI / build (pull_request) Successful in 2m3s
ea12107497
ltms closed this pull request 2026-09-04 11:35:49 +02:00
Some checks are pending
CI / contract (pull_request) Successful in 1m28s
CI / build (pull_request) Successful in 2m3s

Pull request closed

Sign in to join this conversation.