Repository navigation
Description
Severity: P2 (silent storage cost growth; orphans are permanent)
Component: Node Layer — cmd/atelet/main.go
Audit ID: NL-7
Summary
uploadExternalCheckpoint launches one goroutine per snapshot file. If any goroutine
fails, already-uploaded files are not cleaned up — they remain as orphaned objects
in the bucket. Similarly, if the manifest upload fails after all data files upload
successfully, the snapshot data is in the bucket with no manifest. No DeleteObject
call exists anywhere in the codebase. Over time, partial failed checkpoints accumulate
as unreferenced objects consuming storage.
Root Cause
File: cmd/atelet/main.go lines 458–488
g, gCtx := errgroup.WithContext(ctx)
for _, file := range snapshotFiles {
file := file
g.Go(func() error {
return SendLocalFileToGCSWithZstd(gCtx, client, bucket, file)
// If this goroutine SUCCEEDS, objects are in GCS
})
}
if err := g.Wait(); err != nil {
// One goroutine failed — but successful goroutines already wrote objects
// No cleanup of the already-uploaded objects
return err
}
// Upload manifest
if err := writeManifest(ctx, client, bucket, manifest); err != nil {
// Data files are in GCS, manifest is not — orphaned data
return err
}grep -rn "DeleteObject\|DeleteObjects\|Objects().Delete" /Users/adityashantanu/repos/substrate/ — zero results.
Steps to Reproduce
- Configure GCS to accept data file PUTs but reject the manifest PUT (e.g., via
a custom object name ACL or a test proxy that drops requests formanifest.json). - Trigger a checkpoint:
kubectl ate suspend actor my-actor -a demo - Observe:
SuspendActorreturns an error; actor is CRASHED (per ISSUE-002). - List GCS objects for the actor:
gcloud storage ls -r gs://<BUCKET>/<atespace>/<actor-uid>/ # Shows: memory-ranges.zstd, disk.zstd, ... (all data files) # Missing: manifest.json
- These objects remain in the bucket permanently:
# After deleting the actor kubectl ate delete actor my-actor -a demo gcloud storage ls -r gs://<BUCKET>/<atespace>/<actor-uid>/ # Still shows the orphaned data files
Expected Behavior
On partial upload failure, atelet should attempt to delete already-uploaded objects
(best-effort). If the cleanup also fails, the objects should be reported to a "orphan
cleanup" registry or the bucket should have an object lifecycle policy to auto-expire
objects without a companion manifest.json after 24 hours.
Suggested Fix
Short-term: Add a best-effort cleanup in uploadExternalCheckpoint on failure:
if err := g.Wait(); err != nil {
// Best-effort cleanup
for _, uploaded := range successfullyUploaded {
_ = client.DeleteObject(ctx, bucket, uploaded)
}
return err
}Long-term: Configure GCS lifecycle rules on the snapshot bucket:
{
"rule": [{
"condition": {"age": 2, "matchesSuffix": [".zstd"]},
"action": {"type": "Delete"}
}]
}This provides a safety net for any orphaned partial uploads.
Also add a periodic bucket audit that finds objects without a companion manifest.json
in the same prefix and deletes them (or alerts on them).
Activity
[-]Partial GCS/S3 upload on checkpoint leaves orphaned objects — bucket grows without bound[/-][+][P2] Partial GCS/S3 upload on checkpoint leaves orphaned objects — bucket grows without bound[/+]yjjnls commentedon Nov 18, 2026
Adding a viewpoint from the operations side — we run a large fleet of checkpoint/snapshot-backed sandboxes and spend a nontrivial amount of time on exactly this failure class: partial uploads, failed manifests, and the unreferenced objects they leave behind. So this issue reads very familiar.
Two thoughts on shape, for whatever they are worth beyond the issue's own suggestion:
Eitan Yarmush (@EItanya) — is there a plan for the orphan half already, or is it open? Interested in taking this on unless you already have something in progress — happy to coordinate.
EItanya commentedon Nov 20, 2026
Status at 57f360a.
Fixed:
ensureExternalSnapshotsReleasedandactorSnapshotStoragePrefix, Garbage Collect snapshots and remove the snapshot resource #1417). That covers step 5 of the repro.RevertActordeletes the objects of every PENDING durable snapshot the actor still records (ensureInProgressSnapshotDiscarded, feat(api): introduce RevertActor lifecycle RPC #1675).removeScratchinpkg/objectstorage/gcscompose.go, Large GCS uploads no longer leave scratch objects behind #2178).Still open:
uploadSnapshotincmd/atelet/main.goreturns the error and leaves the files already uploaded.releaseDroppedSnapshotsreleases only COMPLETED snapshots, andpruneSnapshotsdrops an earlier PENDING record at the next suspend, so after that onlyDeleteActorremoves them.This status was generated and checked by Claude. Eitan did his best to verify it, but there are a lot of open issues, so please correct anything that is wrong.
Comment left by Claude on behalf of Eitan Yarmush (@EItanya).