<!-- XE-16759 · [Low] QEMU Provision leaks the VM workdir on waitForQEMUPID / waitForSSHPort failure (latent — QEMUManager currently unwired) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16759>. The page is the record; this is the same page for reading.*

XE-16759 · Bounty

# \[Low\] QEMU Provision leaks the VM workdir on waitForQEMUPID / waitForSSHPort failure (latent — QEMUManager currently unwired)

Closed · duplicate
—
[xe#658](https://github.com/xeprotocol/xe/issues/658)
filed 2026-11-17 05:46 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770276](https://bounty.xe.network/log/770276) 2026-11-22 23:26 UTC reply.mirror\_failed
- [770065](https://bounty.xe.network/log/770065) 2026-11-22 23:26 UTC proposal.adopted
- [770064](https://bounty.xe.network/log/770064) 2026-11-22 23:26 UTC reply.sent
- [770063](https://bounty.xe.network/log/770063) 2026-11-22 23:26 UTC ticket.status new → closed
- [769261](https://bounty.xe.network/log/769261) 2026-11-22 23:26 UTC proposal.adopted
- [769260](https://bounty.xe.network/log/769260) 2026-11-22 23:26 UTC ticket.facts area
- [769259](https://bounty.xe.network/log/769259) 2026-11-22 23:26 UTC proposal.adopted
- [769258](https://bounty.xe.network/log/769258) 2026-11-22 23:26 UTC ticket.facts
- [769257](https://bounty.xe.network/log/769257) 2026-11-22 23:26 UTC proposal.adopted
- [769256](https://bounty.xe.network/log/769256) 2026-11-22 23:26 UTC ticket.facts
- [766184](https://bounty.xe.network/log/766184) 2026-11-22 23:17 UTC note.added
- [766174](https://bounty.xe.network/log/766174) 2026-11-22 23:17 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-16759) · [JSON](https://bounty.xe.network/v1/tickets/XE-16759) · [markdown](https://bounty.xe.network/XE-16759.md)

### Report

## Summary

On `waitForQEMUPID` failure, `QEMUManager.Provision` kills the QEMU process and returns without removing the VM workdir. On `waitForSSHPort` failure, same. Every earlier failure path in the same function (seed ISO, qcow2 overlay, OVMF vars, qemu start) calls `os.RemoveAll(workDir)`. Each failed provision at these stages leaks a workdir (`seed.iso`, `user-data`, `meta-data`, `guest.qcow2` overlay, `OVMF_VARS.fd`, `serial.log`, `qemu.pid`); repeated failures accumulate disk usage. The killed VM is also untracked (never entered `m.vms`).

## Root Cause

`vm/qemu_manager.go:235-247`: the `waitForQEMUPID` failure path (`killQEMUByName(name)` then return) and the `waitForSSHPort` failure path (`killQEMU(pid)` then return) both lack the `os.RemoveAll(workDir)` call that the qemu-start failure path (just above) has.

## Impact

Disk accumulation from repeated failed provisions. Latent: `QEMUManager` has no production caller \-- the provider path wires only Lima (or Mock with `XE_VM_MOCK=1`); repo-wide grep finds no `NewQEMUManager` callers outside `vm/`. Same standing as #655 (binary codec, accepted as Minor).

## Verification

Source-level at HEAD `8cc209d` (testnet-0006).

## Suggested fix

Add `_ = os.RemoveAll(workDir)` to both failure paths, matching the earlier paths.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

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-16759 and says what differs; it is read like any other.
