From ad8a05c9091afb26f8e8cb86b9d84c389a0dcd44 Mon Sep 17 00:00:00 2001 From: Jeremy Schoemaker Date: Thu, 20 Aug 2026 14:57:35 -0500 Subject: [PATCH] LinuxPod: stop the VM when setup fails after start LinuxPod.create() called vm.start() outside the do/catch that otherwise cleans up on failure. If vm.start() threw -- for example a vmnet allocation failure surfaced through network device attachment -- the VZVirtualMachine and its com.apple.Virtualization.VirtualMachine.xpc helper process were never stopped. vm is local to create(), so nothing outside could reach it to stop it afterwards. Move vm.start() inside the existing do block so its failure runs the same relayManager.stopAll() / vm.stop() / setErrored path every other setup failure already takes. This is the same fix applied to LinuxContainer.create() in #836, for the sibling call site in LinuxPod. --- Sources/Containerization/LinuxPod.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Containerization/LinuxPod.swift b/Sources/Containerization/LinuxPod.swift index 6275a4d49..f01178416 100644 --- a/Sources/Containerization/LinuxPod.swift +++ b/Sources/Containerization/LinuxPod.swift @@ -627,9 +627,9 @@ extension LinuxPod { let creationConfig = StandardVMConfig(configuration: vmConfig) let vm = try await self.vmm.create(config: creationConfig) let relayManager = UnixSocketRelayManager(vm: vm) - try await vm.start() do { + try await vm.start() let containers = state.containers let shareProcessNamespace = self.config.shareProcessNamespace let pauseProcessHolder = Mutex(nil)