Skip to content

ateworker: reuse completed checkpoint when workload is already stopped - #3015

Open
Chenyi Wang (chw120) wants to merge 1 commit into
agent-substrate:mainfrom
chw120:ateworker-reuse-completed-checkpoint
Open

Chenyi Wang (chw120) wants to merge 1 commit into
agent-substrate:mainfrom
chw120:ateworker-reuse-completed-checkpoint

Conversation

@chw120

Copy link
Copy Markdown
Collaborator

When atelet restarts (or loses the CheckpointWorkload response) after ateworker has already finished writing the snapshot into checkpoint-state/ and torn down the sandbox/VM, atelet has not yet moved checkpoint-state/ into local-checkpoints/<uuid>/ or recorded the snapshot in snapshottracker. When the control plane retries Checkpoint, the replacement atelet calls ateworker.CheckpointWorkload again against a workload that no longer exists (runsc checkpoint: exit status 128).

This PR records an atomic completion marker (checkpoint-state/.checkpoint-done.json) at the end of CheckpointWorkload in both ateworker-gvisor and ateworker-microvm. If a retry arrives when the workload is already unhosted (lookupActor(actorUID) == nil), ReuseCheckpoint verifies that the marker's fidelity matches and all listed SnapshotFiles / DataSnapshotFiles are still present in checkpoint-state/, returning the cached response immediately instead of re-running runsc checkpoint or cloud-hypervisor snapshot.

Once atelet moves the snapshot files into local-checkpoints/<uuid>/ or resets the actor directory via resetActorDirs, the marker is invalidated/removed automatically.

Part of #2836

  • Tests pass

Record a completion marker (.checkpoint-done.json) inside checkpoint-state/ once CheckpointWorkload has written the snapshot files and torn down the workload. If a retry arrives after the workload is gone (for example when atelet restarts or loses the response before moving checkpoint-state/ into local-checkpoints/), ReuseCheckpoint returns the recorded SnapshotFiles and DataSnapshotFiles while they are still intact on disk instead of failing on a missing sandbox.
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