From a16dee6468deef6c8ce2b47e2f077a93b1ee56fe Mon Sep 17 00:00:00 2001 From: jwhur <57657645+JaewonHur@users.noreply.github.com> Date: Tue, 24 Feb 2026 00:39:27 -0800 Subject: [PATCH] Preserve error from ManagedProcess (#555) This PR changes `ManagedProcess` to throw its own error together with `vexec` error. apple/container#1250 reports intermittent failure of CI tests, where the system logs report failing `agent.startProcess` due to the `"read ack pipe"` from `vmexec`. This `"read ack pipe"` is thrown when writing end of `ackPipe` is closed ([ExecCommand.swift#L88](https://github.com/apple/containerization/blob/main/vminitd/Sources/vmexec/ExecCommand.swift#L88)) as EOF is returned from reading `ackPipe`. It again means `ManagedProcess` throws an error after forking the `vmexec` process ([ManagedProcess.swift#L165](https://github.com/apple/containerization/blob/main/vminitd/Sources/vminitd/ManagedProcess.swift#L165)). However, current `ManagedProcess` doesn't throw its error if `errorPipe` has data, which, i.e., `"read ack pipe"`, is actually not the root cause in this case ([ManagedProcess.swift#L244](https://github.com/apple/containerization/blob/main/vminitd/Sources/vminitd/ManagedProcess.swift#L244)). --- vminitd/Sources/vminitd/ManagedProcess.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vminitd/Sources/vminitd/ManagedProcess.swift b/vminitd/Sources/vminitd/ManagedProcess.swift index c7847efb..4ace4045 100644 --- a/vminitd/Sources/vminitd/ManagedProcess.swift +++ b/vminitd/Sources/vminitd/ManagedProcess.swift @@ -263,7 +263,8 @@ extension ManagedProcess { { throw ContainerizationError( .internalError, - message: "vmexec error: \(errorString.trimmingCharacters(in: .whitespacesAndNewlines))" + message: "vmexec error: \(errorString.trimmingCharacters(in: .whitespacesAndNewlines))", + cause: error ) } throw error