Skip to content

fix: Increase XPC timeout for Machine API operations#2006

Open
dev-kvt wants to merge 1 commit into
apple:mainfrom
dev-kvt:fix/xpc-timeout
Open

fix: Increase XPC timeout for Machine API operations#2006
dev-kvt wants to merge 1 commit into
apple:mainfrom
dev-kvt:fix/xpc-timeout

Conversation

@dev-kvt

@dev-kvt dev-kvt commented Jul 23, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

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.swift for create and boot operations to 120 seconds, and stop/delete operations to 60 seconds. It also cleans up TestCLIMachineCommand.swift by removing the withKnownIssue workaround wrapper on testCreateNameLongestValid, as the increased timeout resolves the underlying issue.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

request.set(key: MachineKeys.bootConfig.rawValue, value: bootData)

let _ = try await xpcSend(message: request)
let _ = try await xpcSend(message: request, timeout: .seconds(120))

@jglogan jglogan Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 xpcSend call 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 ls is one), then choose a timeout based on what the call is doing and/or what similar calls in the container-apiserver use.
Suggested change
let _ = try await xpcSend(message: request, timeout: .seconds(120))
let _ = try await xpcSend(message: request)

@jglogan

jglogan commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants