Repository navigation
fix(tart): delete the clone a failed tart clone leaves behind - #100
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of four stacked PRs. Each holds one commit; merge them in order.
Problem
tart clonecan create the clone and still fail, for example when a cancelled context kills the command.bootVMgave 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:
VM "<name>" already exists, use --overwrite to replace it.Tests
In
internal/provider/tart_lifetime_test.go:TestTartProvider_FailedCloneDeletesWhatItLeftTestTartProvider_FailedCloneKeepsVMThatAlreadyExistedTestTartProvider_CloneRefusedByFloorDeletesNothinggo test ./... -race,go vet ./...andgolangci-lint run ./...pass.