Skip to content

Axum: define a production server lifecycle with bounded graceful shutdown #392

Description

@ChristianPavilonis

Description

The standard native runner handles Ctrl-C but has no explicit SIGTERM/readiness/drain-deadline contract on audited main; see crates/edgezero-adapter-axum/src/dev_server.rs:313. PR #406 implements the production lifecycle together with #396, on the unmerged #275 HTTP foundation. Keep this issue open until its accepted stack and process-level acceptance are complete.

Steps to reproduce

Start a generated native application under a subprocess/container supervisor. Send SIGTERM and SIGINT with a finite request in flight, then with a never-ending stream. Observe readiness, admission and process exit against a configured drain deadline. These are required acceptance checks, not results of this audit.

Expected behavior

Startup, ready, draining and stopped states have explicit ownership; signals or an embedding caller stop admission and allow finite work to finish before a bounded forced stop. Initialization/bind failures exit unsuccessfully.

Impact

Supervised deployments cannot rely on Ctrl-C-only shutdown or treat dropping a runtime as graceful process draining. Unbounded termination can interrupt work or exceed an orchestrator grace period.

Proposed fix

Review/integrate PR #406 on accepted #275 connection and completion contracts; reuse one serving path and application-owned readiness checks. Preserve route ownership, embedding shutdown and exactly-once terminal/resource handling. Document HTTP protocol and forced-stop limits separately from response delivery. Do not add another transport bridge.

Done when

  • Re-audit the accepted PR feat: implement portable outbound HTTP and request lifecycle contracts #275 implementation and record which checks are already covered. Add only residual changes and missing production acceptance evidence.
  • Subprocess tests show SIGTERM and SIGINT both initiate graceful shutdown.
  • A finite in-flight request completes during draining; a never-ending request or stream cannot keep the process alive past the configured deadline.
  • Readiness stays false during startup, becomes true after required initialization, and becomes false when draining starts.
  • Invalid configuration, initialization failure, and bind failure return a non-zero exit status with a useful diagnostic.
  • Health checks do not override existing application routes, and embedding callers can supply shutdown without installing signal handlers.
  • State transitions, timeout defaults, and orchestrator termination-grace recommendations are documented.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions