Skip to content

Update container clean for mount namespace trimming - #1

Closed
recrack wants to merge 21 commits into
saehejkang:container-clean-commandfrom
recrack:fix/container-clean-volume-trim
Closed

Update container clean for mount namespace trimming#1
recrack wants to merge 21 commits into
saehejkang:container-clean-commandfrom
recrack:fix/container-clean-volume-trim

Conversation

@recrack

@recrack recrack commented Aug 4, 2026

Copy link
Copy Markdown

Purpose

This updates container-clean-command without opening a duplicate pull request against apple/container.

  • Merge the current apple/container main into the clean-command branch and resolve the API/test-fixture conflicts
  • Keep the runtime identifier contract explicit and reject mismatched clean requests
  • Update clean integration coverage for stopped containers, multiple running containers, root filesystems, and named volumes
  • Measure host allocated blocks with lstat().st_blocks and poll for asynchronous allocation/reclaim changes

Companion change

Named volumes are mounted in the workload container's mount namespace, not vminitd's namespace. The companion draft apple/containerization#830 carries the workload identity through filesystem-operation RPCs and resolves targets through the managed init process root.

This PR should remain a draft until that API shape is agreed and the dependency revision can be updated to the merged containerization commit.

Testing

  • make fmt
  • swift build -Xswiftc -warnings-as-errors --build-tests
  • make container
  • Isolated local integration using a dedicated app root and locally built vminit:latest
    • stopped-container rejection passed
    • cleaning multiple running containers passed
    • root filesystem and named-volume trim RPCs completed without errors
    • host allocated-size assertions are still being stabilized; the current test instrumentation is intentionally retained in this draft for review

Commit structure

  1. Merge current upstream main and resolve conflicts
  2. Apply the runtime-identity and integration-test updates

Both commits are SSH signed locally. GitHub currently reports the key as unknown because this machine's authentication key has not yet been registered separately as a signing key.

jglogan and others added 20 commits July 22, 2026 08:21
- Closes apple#1982.
- Makes warmup image code more readable in tests.
)

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
- Closes apple#2001.
- Handle "container exists" error gracefully instead
  of failing, when trying to start the buildkit container.
- Move build tests to parallel suites, while the builder
  lifecycle tests remain serial. Parallel builds don't
  use the fixture lock that deletes and restarts the
  builder and runs a build block in isolation.
Signed-off-by: Ari Rubinstein <22369+arirubinstein@users.noreply.github.com>
Co-authored-by: Ari Rubinstein <22369+arirubinstein@users.noreply.github.com>
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
…, and validate plugin name (apple#2027)

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Raj Aryan Singh <rajaryan_singh@apple.com>
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
- When container is not running, the runtime helper
  traverses the container's root fs and writes it to the
  specified tar archive or stdout.
- When the container is running, the helper performs
  the same operation but wraps it in freeze/thaw
  to ensure data integrity for the resulting archive.
)

Each container runs in its own guest VM sized to
`--memory` with no swap, so the guest kernel's
stock `vm` sysctl defaults are hit far too easily:

- `vm.overcommit_memory=0` (heuristic overcommit)
  rejects an oversized `mmap()` upfront whenever the
  reservation exceeds the small, swap-less VM's free
  RAM — even if the memory is never touched —
  returning `ENOMEM`.
- `vm.max_map_count=65530` caps per-process
  mapping count, which mapping-heavy applications
  (e.g. Elasticsearch, many JVMs) can exceed.
@recrack

recrack commented Aug 4, 2026

Copy link
Copy Markdown
Author

Closing this fork-targeted PR in favor of the official upstream draft apple#2068. The branch and commit history remain preserved in recrack/container.

@recrack recrack closed this Aug 4, 2026
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.

8 participants