Repository navigation
atelet: detach Checkpoint from caller cancellation once underway - #2602
Conversation
424cfb7 to
160c01a
Compare
5cc0675 to
60152c9
Compare
Abhishek Sharma (abhisheksharma2411)
left a comment
There was a problem hiding this comment.
This shape looks right to me - the two failure modes you describe are the classic retry-after-timeout pair, and serializing per actor plus using the manifest as a commit marker is a good way to handle them.
One thing I checked before raising it: the fast path returns an empty CheckpointResponse, which at first looked like a retry getting a degenerate answer. It isn't - the normal path at main.go:842 returns the same empty response, and the proto documents state as deliberately unset for now. So no issue there.
Two things I did wonder about.
The idempotent fast path is gated on UPLOAD_MODE_DEFERRED. That makes sense for the manifest check itself, since the proto says IMMEDIATE keeps no local copy, so there'd be no manifest.json to find. But that leaves IMMEDIATE with only half the protection: the lock still stops the overlap race, while the "first attempt already finished and cleaned up" case would presumably still fail with sandbox.json: no such file or directory. Is that deliberate, or just out of scope here?
Smaller one: if rec, err := unmarshalSandboxRecord(manifest); err == nil drops the error. A manifest that exists but doesn't parse would silently leave op.sandboxClass empty, so the checkpoint metric ends up unattributed with nothing explaining why. Might be worth a log line on that branch.
60152c9 to
e99e1e5
Compare
Thanks for the review!
|
2605c44 to
c092950
Compare
Synced with #2677. The path now checks the snapshot tracker state instead of |
f83e0e5 to
b082e5a
Compare
44affba to
c3d72fd
Compare
c3d72fd to
27c217f
Compare
Abhishek Sharma (abhisheksharma2411)
left a comment
There was a problem hiding this comment.
Both answered well, thanks.
The IMMEDIATE reasoning makes sense — the proto's TODO about deleting the local snapshot after upload is what made the manifest check inapplicable there, not an oversight. And syncing with #2677 closes it anyway: checking the tracker state rather than manifest.json covers both modes, and I can see the retry test now runs under UPLOAD_MODE_IMMEDIATE as well.
Good catch adding the WarnContext on the unmarshal failure — that was the bit that would have been silent.
Nothing further from me.
27c217f to
3074738
Compare
3074738 to
9198624
Compare
Thanks for the review Abhishek Sharma (@abhisheksharma2411)! Quick update on the scope here: since #2849 now covers answering retried |
1893e19 to
83b7290
Compare
Detach Checkpoint from caller cancellation once past lockActor and BeginCheckpoint so that if a caller times out mid-checkpoint, the in-flight attempt finishes its worker RPC, snapshot commit, and cleanup while holding the actor lock.
83b7290 to
c4fbc79
Compare
| // attempt to finish and commit. Keep the later of the caller's deadline | ||
| // and checkpointTimeout so a hung worker or upload cannot hold the | ||
| // actor's lock forever without shortening a longer caller deadline. | ||
| deadline := time.Now().Add(s.checkpointTimeout) |
There was a problem hiding this comment.
so this means, the checkpoint will still continue, and all other RPCs for this actor on the same node will need to wait for the actorLock to be released.
If we receive another Checkpoint() request, the second Checkpoint() will wait for this operation to finish, and either return deadline exceeded (if timeout), or success (if the first Checkpoint succeeds)
There was a problem hiding this comment.
Yes, exactly! Thanks Zoe Zhao (@zoez7) for review.
Once a checkpoint is underway on
atelet, canceling it mid-flight (for example, when a caller with a shorter deadline times out and retries) killsrunsc checkpointwhile the Sentry continues stopping the workload, leaving the checkpoint incomplete and causing the retry to fail.Detach in-flight checkpoints from caller cancellation once past
lockActorandBeginCheckpoint, keeping the later of the caller's deadline anddefaultCheckpointTimeout(5m) so a hung worker or upload cannot hold the per-actor lock indefinitely without shortening a longer caller deadline. When a caller times out and retries, the original attempt finishes and commits underlockActor, and the queued retry answers from the committed snapshot (#2849).Part of #2836
AI usage: Used Gemini to help trace the checkpoint cancellation flow, draft the fix, and write unit tests.