mirror of
https://github.com/apple/container.git
synced 2026-08-27 02:46:31 +00:00
fix: Increase XPC timeout for Machine API operations (#2006)
- Fixes #2003.
This commit is contained in:
@@ -106,7 +106,7 @@ public struct MachineClient: Sendable {
|
||||
|
||||
let response = try await xpcSend(
|
||||
message: request,
|
||||
timeout: .seconds(10)
|
||||
timeout: nil
|
||||
)
|
||||
let data = response.dataNoCopy(key: MachineKeys.machines.rawValue)
|
||||
guard let data else {
|
||||
@@ -142,7 +142,7 @@ public struct MachineClient: Sendable {
|
||||
let bootData = try JSONEncoder().encode(bootConfig)
|
||||
request.set(key: MachineKeys.bootConfig.rawValue, value: bootData)
|
||||
|
||||
let _ = try await xpcSend(message: request)
|
||||
let _ = try await xpcSend(message: request, timeout: nil)
|
||||
} catch {
|
||||
throw ContainerizationError(
|
||||
.internalError,
|
||||
@@ -158,7 +158,7 @@ public struct MachineClient: Sendable {
|
||||
let request = XPCMessage(route: MachineRoutes.deleteMachine.rawValue)
|
||||
request.set(key: MachineKeys.id.rawValue, value: id)
|
||||
|
||||
let _ = try await xpcSend(message: request, timeout: .seconds(15))
|
||||
let _ = try await xpcSend(message: request, timeout: .seconds(60))
|
||||
} catch {
|
||||
throw ContainerizationError(
|
||||
.internalError,
|
||||
@@ -216,7 +216,7 @@ public struct MachineClient: Sendable {
|
||||
let dynamicEnvData = try JSONEncoder().encode(dynamicEnv)
|
||||
request.set(key: MachineKeys.dynamicEnv.rawValue, value: dynamicEnvData)
|
||||
|
||||
let response = try await xpcSend(message: request)
|
||||
let response = try await xpcSend(message: request, timeout: nil)
|
||||
guard let data = response.dataNoCopy(key: MachineKeys.snapshot.rawValue) else {
|
||||
throw ContainerizationError(
|
||||
.internalError,
|
||||
@@ -239,7 +239,7 @@ public struct MachineClient: Sendable {
|
||||
let request = XPCMessage(route: MachineRoutes.stopMachine.rawValue)
|
||||
request.set(key: MachineKeys.id.rawValue, value: id)
|
||||
|
||||
let _ = try await xpcSend(message: request, timeout: .seconds(30))
|
||||
let _ = try await xpcSend(message: request, timeout: nil)
|
||||
} catch {
|
||||
throw ContainerizationError(
|
||||
.internalError,
|
||||
@@ -272,7 +272,7 @@ public struct MachineClient: Sendable {
|
||||
let request = XPCMessage(route: MachineRoutes.inspectMachine.rawValue)
|
||||
request.set(key: MachineKeys.id.rawValue, value: id)
|
||||
|
||||
let response = try await xpcSend(message: request)
|
||||
let response = try await xpcSend(message: request, timeout: nil)
|
||||
guard let data = response.dataNoCopy(key: MachineKeys.snapshot.rawValue) else {
|
||||
throw ContainerizationError(
|
||||
.internalError,
|
||||
|
||||
@@ -41,19 +41,17 @@ struct TestCLIMachineCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@Test func testCreateNameLongestValid() async {
|
||||
await withKnownIssue("XPC timeout on machine-apiserver.bootMachine", isIntermittent: true) {
|
||||
try await ContainerFixture.with { f in
|
||||
// Start with container ID or DNS label length, whichever is shorter.
|
||||
// Reduce by length of UUID suffix.
|
||||
// Reduce by 1 for dash separator between ID and suffix.
|
||||
let maxHostnameLength = min(LinuxContainer.maxIDLength, 63)
|
||||
let maxNameLength = maxHostnameLength - MachineConfiguration.containerUUIDLength - 2
|
||||
let name = String(repeating: "a", count: maxNameLength)
|
||||
f.addCleanup { f.cleanupMachine(name) }
|
||||
try f.doMachineCreate(name: name, image: machineImage)
|
||||
try f.doMachineBoot(name: name)
|
||||
}
|
||||
@Test func testCreateNameLongestValid() async throws {
|
||||
try await ContainerFixture.with { f in
|
||||
// Start with container ID or DNS label length, whichever is shorter.
|
||||
// Reduce by length of UUID suffix.
|
||||
// Reduce by 1 for dash separator between ID and suffix.
|
||||
let maxHostnameLength = min(LinuxContainer.maxIDLength, 63)
|
||||
let maxNameLength = maxHostnameLength - MachineConfiguration.containerUUIDLength - 2
|
||||
let name = String(repeating: "a", count: maxNameLength)
|
||||
f.addCleanup { f.cleanupMachine(name) }
|
||||
try f.doMachineCreate(name: name, image: machineImage)
|
||||
try f.doMachineBoot(name: name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user