Skip to content

fix(daemon): drain accepted handlers on shutdown - #847

Merged
jleni merged 2 commits into
mainfrom
fix/shutdown-handler-drain
Aug 26, 2026
Merged

fix(daemon): drain accepted handlers on shutdown#847
jleni merged 2 commits into
mainfrom
fix/shutdown-handler-drain

Conversation

@jleni

@jleni jleni commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • make the accept loop own every accepted connection handler in a JoinSet
  • on shutdown, stop admitting post-shutdown frames, finish current responses under one 30-second deadline, then abort and join leftovers
  • preserve the shutdown request's own acknowledgement before its handler exits
  • reap completed and failed handler tasks instead of detaching them until runtime teardown

Reliability coverage

  • real-listener regression gates an in-flight RemoteCheck, sends an actual Shutdown, requires its ACK while the client remains open, proves the accept loop is still draining, then requires the blocked response before loop completion
  • deadline regression proves a silent handler is aborted and joined
  • request-boundary regression proves queued and just-completed frames are not dispatched after shutdown begins
  • task-outcome regression distinguishes successful, panicked, and deadline-cancelled handlers so operational failure visibility is mutation-tested

Validation

  • combined post-fix(daemon): treat remote import failures as misses #841/ci: guard Unix test resources #846 daemon suite through the resource guard: 2,185 passed, 0 failed, 2 ignored with normal process visibility
  • post-rebase strict workspace/all-target/all-feature Clippy with -D warnings
  • post-rebase focused drain/shutdown suite: 7/7 green
  • cargo fmt --all -- --check
  • git diff --check
  • independent review: GO after the post-shutdown dispatch and active-polling test gaps were fixed
  • independent mutation-follow-up review: GO; production classification/logging is unchanged
  • two signed commits on current main (91a442c)

CI follow-up

The first changed-line mutation run found two survivors that removed panic/error observability while leaving request behavior intact. The added success/panic/cancellation truth table rejects both prior survivors plus constant and branch-condition variants.

Follow-up boundary

Tokio spawn_blocking closures are non-cancellable and can outlive an aborted outer handler. This PR does not change that existing boundary; hardening blocking handler work is a separate follow-up.

@jleni
jleni force-pushed the fix/shutdown-handler-drain branch from 872042f to 4f0253c Compare August 26, 2026 08:07
@jleni
jleni merged commit faa8876 into main Aug 26, 2026
20 checks passed
@jleni
jleni deleted the fix/shutdown-handler-drain branch August 26, 2026 08:38
@jleni jleni mentioned this pull request Aug 27, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant