Skip to content

Apply --ulimit in container exec and machine run - #2267

Open
rishabhsai wants to merge 1 commit into
apple:mainfrom
rishabhsai:exec-apply-ulimit
Open

rishabhsai wants to merge 1 commit into
apple:mainfrom
rishabhsai:exec-apply-ulimit

Conversation

@rishabhsai

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

container exec and container machine run embed Flags.Process, so both print --ulimit <limit> in their help and accept the flag without error, but neither ever reads processFlags.ulimits; the only reader is Parser.process on the run/create path. Exec therefore keeps whatever rlimits the init process was started with and the value you passed is dropped with no warning, even though the guest already applies per-process rlimits on exec via App.setRLimits(rlimits: process.rlimits) in containerization's vmexec/ExecCommand.swift. #1129 added --ulimit to Flags.Process and wired it into run and create only, which is where the gap came from. This sets config.rlimits on exec when --ulimit is given, leaving the init process limits in place when it is not, and passes rlimits: into the ProcessConfiguration that machine run builds.

Fixes #2266

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

swift build --product container succeeds and .build/debug/container exec --help | grep ulimit still lists the flag, and make swift-fmt leaves the diff unchanged. The new testExecUlimitNofile in TestCLIExecCommand is compile-verified only: the integration suite needs an installed CLI and a running container system, which I could not run locally, so every test in that suite fails at fixture setup with binaryNotFound on my machine.

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.

container exec accepts --ulimit but ignores it

1 participant