You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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)
Reacted by Albert Dixon, Yu Jiang and Yusuke Sugiyama
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.
Activity
yussugi commentedon Nov 26, 2026
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 workersshowedWORKER_STATE_DRAINING, they calledkubectl ate suspend actor --mode=sync. All actors are Python HTTP servers withSNAPSHOT_FIDELITY_MEMORY, 500m / 256Mi.worker CheckpointWorkload: the worker is unavailable, because the worker had already exited. B becameCRASHED.reverttook it back to its last external snapshot, from its only earlier suspend about 23.5 hours before.Timeline, from deleting the NodeClaim:
WORKER_STATE_ACTIVEWhat this tells us from the user side:
PENDINGis lost with the node. The actor still shows asSUSPENDEDuntil the next resume, which fails withFAILED_PRECONDITION. Filed as [Bug]: Draining a node loses an async suspend's PENDING snapshot, and the actor shows SUSPENDED until a resume fails #4170.