[Bug Report] Failed resume leaves an orphan rootfs CoW object (sb-<id>-rootfs-gen0), permanently blocking all subsequent resumes with 130545 "cubecow object already exists"
Summary
When a resume fails after CubeCoW has already derived the sandbox rootfs CoW layer
(sb-<id>-rootfs-gen0), that object is not cleaned up. Every subsequent resume of the
same sandbox then fails deterministically with:
RetCode 130545: derive v2 default-medium from template fail: cubecow object already exists: name=sb--rootfs-gen0 kind=snapshot origin=tpl-snap--rootfs
The sandbox is left permanently stuck in paused — its pause snapshot is still READY
and fully intact on disk, but it can never be resumed again. There is no supported way to
remove the single leftover object, so the sandbox effectively becomes unrecoverable
(short of deleting it and losing the snapshot).
Environment
- CubeSandbox version: v0.7.0
- Deployment: bare-metal, multi-node (3 nodes), CubeCoW xfs local backend
- Relevant components: CubeMaster, Cubelet, CubeCoW / CubeS3lvol
- Storage: pause snapshots on local xfs (reflink)
Steps to Reproduce
- Create a sandbox from a template, run it, let it auto-pause
(pause snapshot reaches
READY). - Resume it. The resume derives the rootfs CoW layer
sb-<id>-rootfs-gen0from the template rootfs (tpl-snap-<snapid>-rootfs), but the resume then fails/aborts partway (in our case the earlier attempt hit an envd/inittimeout on slow storage; any mid-resume failure after the derive step should reproduce it). - The derived
sb-<id>-rootfs-gen0object is NOT rolled back / cleaned up. - Retry resume → 130545 "cubecow object already exists" for
sb-<id>-rootfs-gen0. Every retry fails identically.
Expected Behavior
Resume should be idempotent with respect to the derived rootfs CoW object. Either:
- on a failed resume, roll back / delete the just-derived
sb-<id>-rootfs-gen0; and/or - on retry, reuse or overwrite the existing
sb-<id>-rootfs-gen0instead of erroring; and/or - provide a supported single-object cleanup entry point (remove one orphan rootfs CoW snapshot object) so operators can unblock the sandbox without destroying it.
Actual Behavior
The leftover object blocks resume forever. Concrete instance
(f214cb9706a7409db82fc25816614c9d):
- cubemaster:
paused, backendxfs, pause_snapsnap-0ac3dcd2bc204d4daa59d418 - DB:
t_cube_sandbox_spec.deleted_at = NULL;t_cube_pause_snapshot.status = READY(no last_error). Snapshot is intact: 8.0G memory image + complete metadata (catalog.json / metadata.json / sandbox_spec.json / snapshot/config.json / state.json). - Leftover object on disk:
/data/cubelet/storage/xfs/objects/volumes/tpl-tpl-<templateid>-build-rootfs/sb-f214cb9706a7409db82fc25816614c9d-rootfs-gen0— its mtime is after the last successful pause, i.e. it was created by the failing resume, not by the pause. - Error (CubeMaster, sandbox_update.go:38):
RetCode 130545 ... cubecow object already exists: name=sb-f214...-rootfs-gen0 kind=snapshot origin=tpl-snap-0ac3dcd2...-rootfs - A client retried resume dozens of times over ~45 min; every attempt returned 130545.
No supported cleanup path (verified on v0.7.0)
cubemastercli sandbox rollback --sandbox-id ... --snapshot-id <pause-snap>→snapshot not found. rollback only accepts runtime snapshots (snapshot ls); pause snapshots are a different namespace, so rollback cannot clear the orphan. (This ran cleanly and did NOT mutate the sandbox.)rcow_purge.shdiscards the entire lvstore (all sandboxes on the node) — far too coarse.- Raw
rmof the object dir / SPDKbdev_lvol_deleteis explicitly warned against by the vendor's ownrcow_purge.shheader (deleting objects under a live blobstore leads to cache-served reads that then fail at random). - Deleting the sandbox cleans the object but also destroys the pause snapshot — i.e. it requires giving up the sandbox.
Impact / Scope
This is not a one-off. On a single 3-node cluster, 4 paused sandboxes currently match the
exact signature (state=paused, no live shim/VM, leftover sb-<id>-rootfs-gen0 on disk);
each will fail resume with 130545 the moment it is resumed. A leftover gen0 on a paused
sandbox is anomalous (the vast majority of paused sandboxes have no gen0 object), which is
what makes it detectable.
Additional Context
Likely the same class as #1521 (paused sandbox can neither resume nor terminate, closed as duplicate) and #985 (CubeMaster state inconsistency / stuck lifecycle after failed pause/resume), but the specific failure mode here — resume-derive of the rootfs CoW layer is not idempotent / not cleaned up on failure — does not appear to be tracked separately. Root-cause framing above is black-box inference from logs + on-disk state on v0.7.0; we did not read the CubeCoW derive/cleanup source.
Source: TencentCloud/CubeSandbox