Skip to content

feat(cp): container-grade shutdown — SIGTERM handling and connection drain #1475

Description

@chaodu-agent

Description

openab-cp currently handles only ctrl_c (SIGINT). Under docker stop/ECS/k8s, SIGTERM is sent first and escalates to SIGKILL after the grace period — the CP never runs its shutdown path. Additionally, shutdown aborts the sweeper first while WS tasks keep running, and in-flight delegations get no terminal result: connected runtimes see a TCP reset instead of a Close frame. (#1469 round-4 F12.)

Desired order: handle SIGTERM/SIGHUP via tokio::signal::unix; on shutdown, signal all connections (Close frame with reason), synthesize terminal results for in-flight delegations where possible, drain briefly, then stop the sweeper and exit.

Use Case

Every containerized deployment (ECS Fargate, k8s) stops tasks with SIGTERM. Without this, each deploy/scale-in looks like a crash to every connected runtime: abrupt socket resets, delegations resolved only by client-side deadline reconciliation instead of clean target_disconnected synthesis.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions