fix: Increase XPC timeout for Machine API operations#2006
Conversation
| request.set(key: MachineKeys.bootConfig.rawValue, value: bootData) | ||
|
|
||
| let _ = try await xpcSend(message: request) | ||
| let _ = try await xpcSend(message: request, timeout: .seconds(120)) |
There was a problem hiding this comment.
@dev-kvt I did a little more looking into this. The thing I was puzzled by is that we never see this sort of thing for container run even if image pulls and unpacks take minutes.
For example, for a pull, no timeout parameter: https://github.com/jglogan/container/blob/main/Sources/Services/ContainerAPIService/Client/ClientImage.swift#L279
You're on the right track, but the answer isn't to increase the timeout, but to get rid of it entirely. For each of the xpcSend calls in this file, have a look at what's happening in corresponding code in the machine-apiserver:
- If the machine-apiserver code makes any
xpcSendcall down to the container-apiserver, remove the timeout from the MachineClient call, regardless of whether the container-apiserver call has a timeout or not:- If it doesn't have a timeout, then the container-apiserver call is expected to take an arbitrarily long amount of time, meaning the MachineClient call will also.
- If it does have a timeout, then MachineClient call doesn't need a timeout because the container-apiserver call timeout should cascade back to MachineClient.
- If the machine-apiserver code makes no calls to container-apiserver (I haven't looked to see which do this, but perhaps
lsis one), then choose a timeout based on what the call is doing and/or what similar calls in the container-apiserver use.
| let _ = try await xpcSend(message: request, timeout: .seconds(120)) | |
| let _ = try await xpcSend(message: request) |
|
@dev-kvt Your commits are signed but unverified. When you update your PR, make sure you've got your signing key set up so GH can verify the commits. |
Type of Change
Motivation and Context
In constrained CI environments, heavy operations such as creating/unpacking images (
createMachine) and booting virtual machines (bootMachine) can take longer than the default 10-second XPC timeout. This causes intermittent test failures (e.g.XPC timeout for request to com.apple.container.core.machine-apiserver/createMachine).This PR increases the XPC request timeouts in
MachineClient.swiftforcreateandbootoperations to 120 seconds, andstop/deleteoperations to 60 seconds. It also cleans upTestCLIMachineCommand.swiftby removing thewithKnownIssueworkaround wrapper ontestCreateNameLongestValid, as the increased timeout resolves the underlying issue.Testing