Conversation
|
Haowei Cai (Roy) (@roycaihw) could you take a look? It covers the restore steps before resume that #2744 doesn't, plus the checkpoint side. |
8f0245d to
56e469b
Compare
Haowei Cai (Roy) (roycaihw)
left a comment
There was a problem hiding this comment.
LGTM
| slog.String("mode", memMode), slog.String("vmm_version", client.Info().Version)) | ||
| if err := client.RestoreWithNetFDs(ctx, restoreDir, restoredNets, memMode); err != nil { | ||
| return fmt.Errorf("while restoring VM with net FDs: %w", err) | ||
| return restoreVMMError(ctx, "restoring VM with net FDs", err) |
There was a problem hiding this comment.
🤖 should-fix 🟡 – A cloud-hypervisor that exits is retried here. If CH dies during vm.restore, for example on a corrupt memory image, the client reads EOF and isVMMTransportError returns true. The comment on restoreVMMError says that case stays Internal. The launch call above has the same gap: a CH that exits at startup times out as ch.ErrNotReady. atelet gives up after maxConsecutiveRetryableRestoreFailures, so the cost is two extra restore attempts. The checkpoint side already checks vmmRunning. Checking chProc.Done() here would match it.
There was a problem hiding this comment.
I checked both paths. During vm.restore, a CH that exits shows up as EOF or ECONNRESET, which isVMMTransportError treats as retryable, so I'll check chProc.Done() there and keep an exited CH as Internal. For the launch case, chProc is already stopped by the time restore.go sees the error, so the fix would go in LaunchVMM, which cold boot also uses. I'd like to keep this PR to the restore path and fix launch in a follow-up, if that's OK.
There was a problem hiding this comment.
That sounds reasonable to me. Let's ensure that's tracked in a followup issue. Max Smythe (@maxsmythe) WDYT?
| // wait leaves the actor serving and the checkpoint can be retried. | ||
| if _, err := client.WaitReady(ctx, 10*time.Second); err != nil { | ||
| return nil, fmt.Errorf("while waiting for CH api-socket: %w", err) | ||
| return nil, checkpointWaitReadyError(ctx, ra, err) |
There was a problem hiding this comment.
🤖 question 🟢 – What bounds the retries when the VMM is alive but never answers? Each attempt now returns Unavailable, and ateapi does not crash the actor on Unavailable. atelet caps restore retries with boundRetryableRestoreError, but I found no equivalent for checkpoint. Before this change the actor crashed on the first failure.
There was a problem hiding this comment.
Nothing bounds it today. atelet passes Unavailable straight through for CheckpointWorkload, and ateapi keeps the actor in SUSPENDING, so a VMM that's alive but never answers would fail every retry until it exits or the actor is deleted. Should I add a cap in atelet like boundRetryableRestoreError in this PR or as a follow-up?
There was a problem hiding this comment.
Let's add the cap. Leaving an actor stuck indefinitely is a regression
There was a problem hiding this comment.
While cross-checking this before adding it, I found that a cap in atelet like boundRetryableRestoreError would also cap an unreachable worker, which #3123 left uncapped on purpose so a drain doesn't crash the actor and lose its state.
Two ways to do it:
A) Cap any Unavailable from CheckpointWorkload at 3 in atelet, like restore. Simple, but an unreachable worker would also crash the actor after 3 tries, and TestCheckpointKeepsWorkerUnavailable would change.
B) Cap only the "VMM alive but not answering" case in the microVM worker, so an unreachable worker keeps retrying as #3123 intended.
Which do you prefer? cc Max Smythe (@maxsmythe) Aditya Shantanu (@aditya-shantanu)
| Fidelity: ateworkerpb.SnapshotFidelity_SNAPSHOT_FIDELITY_MEMORY, | ||
| } | ||
|
|
||
| ctx, cancel := context.WithTimeout(t.Context(), 200*time.Millisecond) |
There was a problem hiding this comment.
🤖 should-fix 🟡 – The 200ms deadline can flake the "VMM answering" row. If the ping has not returned by then on a loaded runner, the call fails before Deactivate and the row reports deactivated = false. That row could use t.Context() directly, since it ends at the panic. The "VMM not answering" row fails on the context deadline, so no test drives CheckpointWorkload to the Unavailable return.
There was a problem hiding this comment.
I ran it: the "VMM not answering" row stops on the 200ms deadline and never reaches the Unavailable return. I'll remove the 200ms deadline and make that row actually reach Unavailable.
| defer cancel() | ||
| var err error | ||
| deactivated := func() (panicked bool) { | ||
| defer func() { panicked = recover() != nil }() |
There was a problem hiding this comment.
🤖 nit 🟢 – Any panic counts as reaching Deactivate. A nil dereference elsewhere in CheckpointWorkload would pass the "VMM answering" row. Checking that the recovered value is a nil pointer dereference, or giving the service a Tunnel the test can observe, would make the signal specific.
There was a problem hiding this comment.
Agreed that any panic is too broad. A nil-pointer check would still match other nil fields, and the tunnel is a concrete type, so I'll make the row check that the panic came from Deactivate itself.
| @@ -0,0 +1,178 @@ | |||
| //go:build linux | |||
|
|
|||
| // Copyright 2026 Google LLC | |||
There was a problem hiding this comment.
🤖 should-fix 🟡 – This header fails hack/verify/boilerplate.sh on current main, which requires Copyright 2026 The Agent Substrate Authors. I merged main into this head locally and the verifier reported this file. The branch dates from October 29 and needs a rebase.
There was a problem hiding this comment.
I'll rebase onto main and update the header to The Agent Substrate Authors.
| if errors.Is(err, ch.ErrNotReady) { | ||
| return true | ||
| } | ||
| var opErr *net.OpError |
There was a problem hiding this comment.
🤖 nit 🟢 – Matching every *net.OpError makes most of the list below unreachable. ECONNREFUSED, ECONNRESET, EPIPE and os.ErrDeadlineExceeded all arrive from the socket wrapped in an OpError. It also retries failures that will repeat, such as EINVAL from WriteMsgUnix. Keeping only the explicit list would be narrower.
There was a problem hiding this comment.
Right, those errors all arrive wrapped in *net.OpError, and it also matches things like EINVAL. Dropping it breaks the "nobody on the socket" row, which gets ENOENT, so I'll drop it and change that row to a socket that refuses the connection.
| // been touched yet, so a retry is safe. A VMM that exited stays an internal | ||
| // error, since watchVM reports that crash, and so does the caller's context | ||
| // ending. | ||
| func checkpointWaitReadyError(ctx context.Context, ra *runningActor, err error) error { |
There was a problem hiding this comment.
🤖 nit 🟢 – The comment says the caller's context ending is reported, but ctx comes from ateworker.CheckpointContext, which drops the caller's cancellation and keeps only its deadline. The "caller gone" test row passes context.Canceled, which this call site cannot produce.
There was a problem hiding this comment.
Right, CheckpointContext keeps only the deadline. I'll fix the comment and change that test row to DeadlineExceeded.
… retry A checkpoint whose VMM api-socket didn't answer in time, or a restore whose new VMM didn't answer or whose api-socket failed during vm.restore, failed with an internal error and crashed the actor, though nothing had changed that a retry couldn't redo. The worker now reports these as Unavailable, and a checkpoint reaches the VMM before it deactivates the actor's networking. Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
56e469b to
181d150
Compare
…t.go Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
… test Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
…t test Signed-off-by: Nishanth Kotla <nishanthkotla@google.com>
Under load, a microVM checkpoint or restore can fail because cloud-hypervisor is slow to answer its api-socket. Nothing has changed at that point that a retry can't redo, but the worker returns a plain error and ateapi crashes the actor. We saw this crash an actor on an untuned node under snapshot load (restore: VMM api-socket not ready after 15s).
Part of #3046
WaitReadynow runs beforetunnel.Deactivate, so a failed wait leaves the actor serving. AWaitReadytimeout returns Unavailable while the worker still tracks a running VMM and the checkpoint deadline has not passed.LaunchVMMandRestoreWithNetFDstimeouts and transient api-socket errors return Unavailable. The existing defers stop the VMM and undo host state. Errors CH itself returns, other socket errors, and a CH that exited during vm.restore stay Internal.ch.WaitReady's timeout error matches the newch.ErrNotReady.This builds on #2744 (restore) and #3123 (checkpoint), which keep Unavailable through atelet.
AI use: AI-assisted, I reviewed and tested it.