Repository navigation
Fix forwarded process signal encoding - #1778
Conversation
|
I hit this independently while building on ContainerAPIClient, in a form broader than the resize noise in #1747: Two notes from checking this change against the server path:
Sending names instead of numbers also avoids the Darwin/Linux mismatch on USR1 and USR2, which a numeric fix would have gotten wrong. Nice work. |
|
Thanks, this was helpful. Added explicit I also added a Darwin-only |
|
@vincent-peng We've been swamped with security issues and other backlog but your fix looks good if can rebase and add verified commit signatures (see https://github.com/apple/containerization/blob/0cb4d5bdd8e575e2bdbeb03278c0c07d7a80a989/CONTRIBUTING.md#pull-requests). Thank you for the contribution! |
|
@vincent-peng it looks like the original commits lack signatures but your last commit is good. When you rebase onto main, perhaps squash your changes into a single signed comment and we can do a CI run on that. |
c58fd89 to
ca4884f
Compare
de0063a to
b37ed58
Compare
|
Thanks for the quick turn! Building now. |
Code Coverage
|
jglogan
left a comment
There was a problem hiding this comment.
@vincent-peng Everything looks good. I've just added an API compatibility note for documentation, and some suggestions for future work here that don't need to gate this PR. Thanks again for your work and for your patience!
| request.set(key: .processIdentifier, value: id) | ||
| request.set(key: .signal, value: Int64(signal)) | ||
| request.set(key: .processIdentifier, value: processId) | ||
| request.set(key: .signal, value: try forwardedSignalName(signal)) |
There was a problem hiding this comment.
Note
This is a breaking change to the XPC "wire protocol", but it fixes a client-server incompatibility that has existed for all 1.x releases (#628 added the Int64 signal on the server side and #1589 changed it to String on the server and in ContainerClient but not ClientProcess).
From a compatibility perspective, if we consider all application releases since 1.0.0 to use "version 1" of the XPC API, all clients prior to the next (1.7.0) release will see #1876 on a version 1 container-apiserver, and all subsequent version 1 API clients will work against any version 1 server.
|
|
||
| try await xpcClient.send(request) | ||
| static func forwardedSignalName(_ signal: Int32) throws -> String { | ||
| guard let name = Signal.platformName(signal), Signal.linux[name] != nil else { |
There was a problem hiding this comment.
Follow-on for anyone who wants it: rework this check using the os value from the running container image's platform. The best solution may be to propose a change down in Containerization.Signal, as right now it's platform helper is based on the host platform, which doesn't make much sense for container signals.
| } | ||
|
|
||
| try await xpcClient.send(request) | ||
| static func forwardedSignalName(_ signal: Int32) throws -> String { |
There was a problem hiding this comment.
@chengboonrong Numeric fallback here now in #1997?
apple/container **1.6.1** is out (previously tracked: `1.2.0`). Upstream notes: https://github.com/apple/container/releases/tag/1.6.1 — mirrored in `docs/upstream/apple-container-1.6.1.md`. ## Review checklist - [ ] New or changed CLI flags Gantry should surface (`container run/create/machine/build`) - [ ] Changed `--format json` shapes the DockerKit apple transport decodes - [ ] Fixed upstream bugs Gantry currently works around - [ ] `ContainerTooling.recommendedVersion` / feature gates need moving to `1.6.1` - [ ] MCP tools and App Intents that expose the affected commands - [ ] README and CHANGELOG entries for whatever is adopted Merging records the version as reviewed. Implement the adopted parts on this branch, or merge as-is and open follow-ups. --- <details><summary>Upstream release notes</summary> ⌨️ denotes breaking CLI changes. 👩💻 denotes breaking API changes. - Core - [Fix signals not properly passed to container processes](apple/container#2276) - Kubernetes - [Fix problems when creating clusters concurrently](apple/container#2276) - [Rename to `container cluster`](apple/container#2427) ## What's Changed * Fix host port conflicts and leftover failed nodes during cluster creation by @dkovba in apple/container#2399 * Fix forwarded process signal encoding by @vincent-peng in apple/container#1778 * Remove SIGWINCH from signal kill set by @ArasanDev in apple/container#1854 * Infer platform and runtime from OCI image by @noah-thor in apple/container#2422 * rename to container cluster by @crosbymichael in apple/container#2427 ## New Contributors * @vincent-peng made their first contribution in apple/container#1778 * @ArasanDev made their first contribution in apple/container#1854 **Full Changelog**: apple/container@1.6.0...1.6.1 </details> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
) apple/container 1.6.1 pins containerization 0.53.0. No source changes are needed here. The release fixes ClientProcess.kill (apple/container#1778), which sent the signal as an integer while the API server reads it as a name, so every kill of an exec'd process failed with "missing signal in xpc message" (apple/container#1941). The health loop uses that kill to stop a probe that runs past its timeout, so a hung probe was never stopped: it stayed in the container, and ProbesInFlight failed every later probe without running it until the hung one exited by itself. With this bump the probe is killed at its deadline and the next probe runs. The fix is in the client library, so it needs this rebuild, and it works against a 1.6.0 API server as well: that server already reads the signal as a name. ProbesInFlight stays, since a probe can still outlive its kill by ignoring SIGTERM or when the kill times out. Its comment no longer cites the fixed issue. Signed-off-by: Wes Morgan <git@wesmorgan.me> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Root cause
Foreground non-tty signal forwarding sent
.signalas an integer, but the API server reads that field as a string before forwarding it to the runtime. That made forwarded resize signals fail withmissing signal in xpc message. A numeric-only fix would also risk mis-mapping Darwin USR1/USR2 values to Linux.Validation
swift test --filter ContainerAPIClientTests.ClientProcessTestsswift test --filter ContainerAPIClientTestsswift build --target ContainerAPIClient