Skip to content

Conversation

@dcantah
Copy link
Contributor

@dcantah dcantah commented Nov 13, 2025

This change is aimed at making forgetting to call .delete() on a LinuxProcess less destructive than it can be. Because Virt.framework invalidates any vsock fds it vended if the vm is stopped, trying to perform some operations on the grpc client through any of the process methods could trigger an ebadf, which NIO asserts on. This keeps a reference to the execs and deletes all of them for you once the container dies. I still think leaving .delete a public method is useful as otherwise the stdio fds are left open, but cleanup should occur all in one place now if you don't care about this.

This additionally:

  1. Fixes two of our tests that forgot to delete() an exec.
  2. Adds two new tests to verify that process.delete() is now idempotent, and we don't need to call delete().

This change is aimed at making forgetting to call .delete()
on a LinuxProcess less destructive than it can be. Because
Virt.framework invalidates any vsock fds it vended if the vm
is stopped, trying to perform some operations on the grpc client
through any of the process methods could trigger an ebadf, which NIO
asserts on. This keeps a reference to the execs and deletes all of them
for you once the container dies. I still think leaving .delete a public
method is useful as otherwise the stdio fds are left open, but cleanup
should occur all in one place now if you don't care about this.

This additionally:

1. Fixes two of our tests that forgot to delete() an exec.
2. Adds two new tests to verify that process.delete() is now idempotent,
and we don't need to call delete().
ijohnnyevan-bot

This comment was marked as spam.

@dcantah dcantah merged commit c854931 into apple:main Nov 13, 2025
2 checks passed
richardkiene added a commit to Vas-Solutus/arca-containerization that referenced this pull request Dec 1, 2025
Sync with Apple's containerization repo (57 commits behind).

Notable upstream changes:
- LinuxContainer: "Harden" stop (apple#388)
- OCI runtime support (apple#416)
- Memory threshold monitoring (apple#427)
- FileHandle option for serial console (apple#410)
- Keep reference to vended execs (apple#408)
- Sync(2) on shutdown (apple#400)
- Fix ImageStore.prune() behavior (apple#420)
- Various stability improvements

Resolved conflicts:
- LinuxContainer.swift: Merged bootLog type change with our useNetworkNamespace
- Application.swift: Kept our service startup code (removed old log line per upstream)
- Server+GRPC.swift: Used upstream's async ManagedContainer, kept our DNS comment
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.

3 participants