[GIT PULL] register: avoid overshooting the file descriptor limit - #1638
Open
vpfkfl753 wants to merge 1 commit into
Open
[GIT PULL] register: avoid overshooting the file descriptor limit#1638vpfkfl753 wants to merge 1 commit into
vpfkfl753 wants to merge 1 commit into
Conversation
File registration retries -EMFILE after raising RLIMIT_NOFILE. The helper adds nr to rlim_cur even though nr is the table size, not an increment. With a soft limit of 64, a hard limit of 96 and nr=80, it requests a soft limit of 144. setrlimit fails and all three registration helpers still return -EMFILE. Set the soft limit to nr. Add a regression for regular, tagged and sparse tables, with each case in a child process so the reduced hard limit does not affect the parent. Tested on Linux 7.0.0-28-generic: file-register-nofile, file-register, file-update, file-verify, file-exit-unreg and io_uring_register pass. All three new cases fail with -EMFILE before the fix. Signed-off-by: Sungwon Woo <vpfkfl753@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
File registration adds the requested table size to the current soft limit. With soft=64, hard=96 and a request for 80 files, the resulting limit of 144 is rejected and registration returns
-EMFILE, even though 80 is allowed.Set the soft limit to the requested size. The regression covers regular, tagged and sparse tables in separate child processes and checks that the hard limit is unchanged.
The new test fails in all three modes before the fix. Afterward, it and
file-register,file-update,file-verify,file-exit-unreg, andio_uring_registerpass on Linux 7.0.0-28-generic with GCC 13.3.git request-pull output:
Click to show/hide pull request guidelines
Pull Request Guidelines
notification, use
[GIT PULL]as a prefix in your PR title.Commit message format rules:
Signed-off-bytag with your real name and email. For example:The description should be word-wrapped at 72 chars. Some things should
not be word-wrapped. They may be some kind of quoted text - long
compiler error messages, oops reports, Link, etc. (things that have a
certain specific format).
Note that all of this goes in the commit message, not in the pull
request text. The pull request text should introduce what this pull
request does, and each commit message should explain the rationale for
why that particular change was made. The git tree is canonical source
of truth, not github.
Each patch should do one thing, and one thing only. If you find yourself
writing an explanation for why a patch is fixing multiple issues, that's
a good indication that the change should be split into separate patches.
If the commit is a fix for an issue, add a
Fixestag with the issueURL.
Don't use GitHub anonymous email like this as the commit author:
Use a real email address!
Commit message example:
By submitting this pull request, I acknowledge that: