Skip to content

fix(tart): delete the clone a failed tart clone leaves behind - #100

Merged
ysya merged 1 commit into
mainfrom
fix/tart-failed-clone-leftover
Dec 1, 2026
Merged

ysya merged 1 commit into
mainfrom
fix/tart-failed-clone-leftover

Conversation

@ysya

@ysya ysya commented Dec 1, 2026

Copy link
Copy Markdown
Owner

First of four stacked PRs. Each holds one commit; merge them in order.

Problem

tart clone can create the clone and still fail, for example when a cancelled context kills the command. bootVM gave its host slot back and returned. Nothing tracked that VM yet, so the clone stayed on disk until the next start of runscaler removed it as an orphan.

It showed with the warm pool: a pool that was shut down while a worker was cloning its next VM left that clone behind. A test that runs the provider through real processes (the next PR in this stack) failed 10 of 30 runs because of it.

Fix

A failed clone is deleted, with a 30-second deadline. Two failures delete nothing:

  • A clone the free-space floor refused never reached Tart.
  • A clone Tart refused because the name is taken left a VM that belongs to someone else. Tart 2.40.1 reports this as VM "<name>" already exists, use --overwrite to replace it.

Tests

In internal/provider/tart_lifetime_test.go:

Test Before the fix
TestTartProvider_FailedCloneDeletesWhatItLeft fails: clone deleted 0 times, want 1
TestTartProvider_FailedCloneKeepsVMThatAlreadyExisted passes; guards the name-taken case
TestTartProvider_CloneRefusedByFloorDeletesNothing passes; guards the floor case

go test ./... -race, go vet ./... and golangci-lint run ./... pass.

Tart can create the clone and still fail, for example when a cancelled
context kills the command. Nothing tracked that VM yet, so it stayed on
disk until the next start of runscaler removed it as an orphan. A warm pool
that was shut down while a worker was cloning its next VM left one behind
about one time in three.

A failed clone is now deleted, with a deadline. A clone refused by the
free-space floor never reached Tart, and one Tart refused because the name
is taken left a VM that belongs to someone else, so neither is deleted.
@ysya
ysya merged commit ca4d7a7 into main Dec 1, 2026
12 checks passed
@ysya
ysya deleted the fix/tart-failed-clone-leftover branch December 1, 2026 19:31
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