Skip to content

Commit a872bfe

Browse files
committed
Kill native processes on LinuxContainer.kill
Native processes should be managed the same as init process as they are direct children of vminitd process. Thus, they should receive a signal as well when container receives a signal.
1 parent 13b3b52 commit a872bfe

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Sources/Containerization/LinuxContainer.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,11 @@ extension LinuxContainer {
849849
public func kill(_ signal: Signal) async throws {
850850
try await self.state.withLock {
851851
let state = try $0.startedState("kill")
852+
853+
for process in state.vendedProcesses.values where process.native {
854+
try await process.kill(signal)
855+
}
856+
852857
try await state.process.kill(signal)
853858
}
854859
}

Sources/Containerization/LinuxProcess.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public final class LinuxProcess: Sendable {
9494

9595
private let state: Mutex<State>
9696
private let ioSetup: Stdio
97-
private let native: Bool
97+
let native: Bool
9898
private let agent: any VirtualMachineAgent
9999
private let vm: any VirtualMachineInstance
100100
private let ociRuntimePath: String?

0 commit comments

Comments
 (0)