Skip to content

Auto-suspend actor on worker eviction #1707

Open

Description

Right now worker eviction is handled by sending SIGTERM to the actor. To gracefully exit, the actor needs to trap SIGTERM and self-suspend.

To improve the user experience, we should allow actors to configure how eviction is handled, starting with auto-suspend on eviction. This likely is dependent on #450 as there still needs to be some coordination with the actor, but it would avoid the need to trap SIGTERM.

The ultimate goal here is to simplify the custom logic actors require for handling eviction. For full memory snapshots we need some hook so the actor can flush, save state, etc... before suspend. Can we do better for disk only snapshots?

We should investigate if the suggestion from Brandon Royal (@brandonroyal) is possible.

Where rootfs, durdir snapshots are enabled, allow the SIGTERM to be handled by the application but trigger the suspend AFTER PID 1 returns exit code 0 (again, assuming this is possible)

Activity

  1. added
    kind/feature
    on Sep 17, 2026
  2. yussugi commented on Nov 26, 2026

    @yussugi

    Some measurements from a node replacement, in case they help with the design.

    Setup: v1.0.1 on EKS 1.37, gVisor workers on a Karpenter NodePool (m8g.xlarge, arm64). Two workers on one node. We deleted the node's NodeClaim, which drains it the same way a drift or an AMI update does. A person played the driver: as soon as kubectl ate get workers showed WORKER_STATE_DRAINING, they called kubectl ate suspend actor --mode=sync. All actors are Python HTTP servers with SNAPSHOT_FIDELITY_MEMORY, 500m / 256Mi.

    Actor Before the drain Result
    A: traps SIGTERM and does not exit RUNNING The sync suspend returned in about 5 seconds. It resumed on the new node with its memory intact.
    B: Python's default SIGTERM handling, so it exits RUNNING The suspend failed with worker CheckpointWorkload: the worker is unavailable, because the worker had already exited. B became CRASHED. revert took it back to its last external snapshot, from its only earlier suspend about 23.5 hours before.
    C: suspended with the default async mode just before the drain SUSPENDED, upload still pending Lost. See below.
    D: suspended long before, upload complete SUSPENDED Resumed on the new node.

    Timeline, from deleting the NodeClaim:

    • about 2s: SIGTERM reached the actors (A recorded the time)
    • about 40s: the replacement node was Ready
    • about 85s: the driver suspended A. The worker hosting A exited right after: B, the only other actor on it, had already exited on SIGTERM, so nothing was left to wait for.
    • about 95s: atelet on the old node got SIGTERM and finished shutting down 2ms later
    • about 2.5 min: the new workers were WORKER_STATE_ACTIVE

    What this tells us from the user side:

    • The worker waits for actors that are still alive. An actor that exits on SIGTERM gives the driver nothing to suspend, so it is lost however fast the driver reacts. Today this has to be guaranteed by every actor image. Auto-suspend on eviction would remove that requirement, which is why we'd like this issue.
    • With A's handler and a driver, a node replacement takes minutes and keeps memory state. That is a strong result. The catch is that both pieces are on the user today.
    • C shows a related gap: an async suspend's snapshot that is still PENDING is lost with the node. The actor still shows as SUSPENDED until the next resume, which fails with FAILED_PRECONDITION. Filed as [Bug]: Draining a node loses an async suspend's PENDING snapshot, and the actor shows SUSPENDED until a resume fails #4170.
    • B also shows why [Feature]: A checkpoint that stores an actor without suspending it #3299 (a checkpoint without suspend) matters: a busy actor's last external snapshot can be very old.
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

    area/api-machinerykind/feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions