Report
XE Bounty — Laporan siap file (temuan pass 5 #5)
File issue baru di: https://github.com/xeprotocol/xe/issues/new Paste judul + isi di bawah. Akun GitHub: Gib230223.
Judul
[Low] Lima Provision: limactl create failure leaks the instance — no delete --force, unlike the start/SSH failure paths
Isi
Summary
LimaManager.Provision has three failure paths after the template is written. The start and waitForSSHPort paths both clean up (stop + delete --force + remove template). The create path removes only the template file — it never deletes the instance. A create that fails after the instance exists leaves disk/state behind, blocks re-provision of the same lease name (limactl create with the same name fails while the orphan exists), and is only reaped by cleanOrphans at next manager construction (node restart).
Evidence
// vm/lima_manager.go:120-123 — create failure: template removed, instance NOT deleted:
if _, err := m.runLimactlWithTimeout(2*time.Minute, "create", "--tty=false", "--name="+name, templatePath); err != nil {
_ = os.Remove(templatePath)
return nil, fmt.Errorf("lima create: %w", err)
}
// vm/lima_manager.go:125-133 — start failure: delete --force + template removed:
if _, err := m.runLimactlWithTimeout(5*time.Minute, "start", "--tty=false", name); err != nil {
diag := m.captureDiagnosticLogs(name)
_, _ = m.runLimactl("delete", "--force", name)
_ = os.Remove(templatePath)
...
}
// vm/lima_manager.go:135-144 — waitForSSHPort failure: stop + delete --force + template removed:
if _, err := m.waitForSSHPort(name, 2*time.Minute); err != nil {
diag := m.captureDiagnosticLogs(name)
_, _ = m.runLimactl("stop", name)
_, _ = m.runLimactl("delete", "--force", name)
_ = os.Remove(templatePath)
...
}
The only other cleanup is cleanOrphans (vm/lima_manager.go:325), which deletes every xe-* limactl instance — but it runs only in the constructor (NewLimaManager, line ~85), i.e. at node restart. Within a running process, a failed create leaves a live orphan that also blocks a retry of the same lease: Provision checks only its in-memory m.vms map (which has no entry for the failed lease), so the retry reaches limactl create --name=xe-<hash> again and fails on the existing instance name.
Impact (Low)
Orphaned Lima instances accumulate on disk after create failures, and the affected lease cannot be re-provisioned until the node restarts (when cleanOrphans runs). Severity is Low: narrow trigger (create must fail after the instance exists — e.g. disk provisioning failure), bounded impact (one instance per failed lease, reaped at restart), no fund movement.
Reproduction (PoC)
Test with a fake limactl script, vm/poc5_lima_create_leak_test.go, TestPoc5LimaCreateLeak, go test ./vm/ -run TestPoc5LimaCreateLeak -v -count=5. The fake records every invocation; create touches a marker file (simulating the instance on disk) and then fails; delete --force removes the marker. Phase 1 stages a create failure and asserts zero delete --force calls with the marker still present; phase 2 (control) stages a start failure and asserts delete --force IS called.
Coordinator run (2026-11-12 ~23:18 WIB), 5/5 PASS:
phase 1: create failed as staged; delete --force calls so far: 0 (want 0); instance marker present: yes
phase 2: start failed as staged; delete --force calls total: 1
BUG REPRODUCED: `limactl create` failure leaves the instance behind (0 delete --force calls), while the `start` failure path cleans up (1 call) — Provision's create error path removes only the template file
Suggested fix
Mirror the start-failure path in the create-failure path:
if _, err := m.runLimactlWithTimeout(2*time.Minute, "create", "--tty=false", "--name="+name, templatePath); err != nil {
_, _ = m.runLimactl("delete", "--force", name)
_ = os.Remove(templatePath)
return nil, fmt.Errorf("lima create: %w", err)
}
Novelty note
No ticket covers Lima create-failure cleanup. Closest, all verified: XE-1438 (QEMU/Lima VM managers bind guest SSH on 0.0.0.0, premature SLIRP readiness, GPU FLR, global lock — different defects in the same managers); pass-3 #5 (QEMU workdir leak on waitForQEMUPID/waitForSSHPort failure — different manager, different leaked resource, different failure paths). Board greps for lima/limactl/create-leak/orphan return no ticket; GitHub live search_issues returns 0 hits. Checked the live bounty board (High+Medium and Minor views) and the GitHub repo issues, 2026-11-12.
Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.
Thread
Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-13369 and says what differs; it is read like any other.