Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix max open files limit for qemu #20643

Merged
merged 1 commit into from Nov 11, 2023
Merged

fix max open files limit for qemu #20643

merged 1 commit into from Nov 11, 2023

Conversation

ghost
Copy link

@ghost ghost commented Nov 9, 2023

Does this PR introduce a user-facing change?

No.

- fix max open files limit for qemu (mainly applicable to MacOS, issue: https://github.com/containers/podman/issues/16106 ) 

Fixes issue: #16106

@rhatdan
Copy link
Member

rhatdan commented Nov 9, 2023

Thanks @protosam
/approve
LGTM
@baude @n1hility @mheon PTAL

Copy link
Contributor

openshift-ci bot commented Nov 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: protosam, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2023
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.


// 3) change rLimit to maximum value
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &syscall.Rlimit{
Max: syscall.RLIM_INFINITY,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the limit this high can potentially fail. On Linux anything greater than /proc/sys/fs/nr_open can throw EPERM, and on Mac OS, some versions can through EINVAL if you exceed OPEN_MAX(10240). There could also be cases where the hard limit is set lower than the system max, in which you could raise the soft to match the hard limit. Most likely podman machine is not running as root, so that could be the solution to just set soft to match the current hard limit

Copy link
Author

@ghost ghost Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't find solid documentation on it, so I'm guessing that syscall.Rlimit.Max is the hard limit and syscall.Rlimit.Cur is the soft limit.

Does the last change I made resolve this?

Copy link
Member

@n1hility n1hility Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks good and thats right Cur = soft. FYI you can find the docs in the OSX/Linux man pages man setrlimit

@n1hility
Copy link
Member

n1hility commented Nov 9, 2023

Thanks for the PR! Just one note above on the usage of RLIIMIT_INFINITY

@ghost
Copy link
Author

ghost commented Nov 10, 2023

Renamed the variable rLimit to rLimitNoFile to be less vague.

@rhatdan
Copy link
Member

rhatdan commented Nov 10, 2023

Compilation is failing.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already code in cmd/podman/early_init_linux.go to handle this for linux for all podman processes.

I suggest you simply extend that file to also run on macos instead of setting this only for a single command.

@ghost
Copy link
Author

ghost commented Nov 10, 2023

There is already code in cmd/podman/early_init_linux.go to handle this for linux for all podman processes.

I suggest you simply extend that file to also run on macos instead of setting this only for a single command.

This looks like dead code to me. I don't see that setRLimits is being consumed in this repo.

% grep -ril setRLimits
./cmd/podman/early_init_linux.go
./vendor/github.com/containers/buildah/CHANGELOG.md
./vendor/github.com/containers/buildah/changelog.txt
./vendor/github.com/containers/buildah/chroot/run_common.go

@Luap99
Copy link
Member

Luap99 commented Nov 10, 2023

it is called in earlyInitHook() which is called from cobra.OnInitialize() in cmd/podman/root.go

@ghost
Copy link
Author

ghost commented Nov 10, 2023

Works for me. I've made changes to that affect. Let's see if this passes CI. 🤞

@ghost
Copy link
Author

ghost commented Nov 10, 2023

Not sure what to do about the "Build Each Commit" job. Should I just squash this commit history? Idk if it understand how to handle that based on it's output.

@n1hility
Copy link
Member

n1hility commented Nov 10, 2023

Not sure what to do about the "Build Each Commit" job. Should I just squash this commit history? Idk if it understand how to handle that based on its output.

Yes please squash your commits. The rule is that if it's needed (make review easier) you can have multiple commits, but each individual commit has to be buildable and pass lint and whitespace checks on its own. Also, its good practice to keep the history of the project clean as possible: the commits should all build toward the same destination vs a local iterative work-stream where the changes replace and undo each other. What I recommend doing if you want to preserve your local history, is to just create a new branch as a local backup, and rebase the existing one to a clean patch set, and then force push. In this case it's a small enough change that one commit should be sufficient.

[NO NEW TESTS NEEDED]

Signed-off-by: Sam Peterson <[email protected]>
@TomSweeneyRedHat
Copy link
Member

LGTM

@n1hility
Copy link
Member

/lgtm

thanks again!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 11, 2023
@openshift-merge-bot openshift-merge-bot bot merged commit a22c290 into containers:main Nov 11, 2023
93 checks passed
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Feb 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants