std: treat ENFILE as transient in the pidfd support probe#158486
Open
valentynkit wants to merge 1 commit into
Open
std: treat ENFILE as transient in the pidfd support probe#158486valentynkit wants to merge 1 commit into
valentynkit wants to merge 1 commit into
Conversation
The probe handles EMFILE (per-process fd limit) as a transient error and re-probes later, but lets ENFILE (system-wide fd limit) fall through to the catch-all arm meant for an old kernel without pidfd support, which permanently caches the pidfd path as unsupported. ENFILE is the same transient condition, so handle both.
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.
The pidfd support probe special-cases
EMFILEfrompidfd_open: it returns theerror without caching anything, so the next spawn re-probes.
ENFILEfallsthrough instead, into the fallback arm, so the probe caches pidfd as unsupported
for the rest of the process, even after descriptors free up.
Both errnos come from the same
pidfd_opencall and mean the same thing: theprocess is out of file descriptors, just per-process (
EMFILE) vs system-wide(
ENFILE). I don't see a reason to treat them differently here, so this handlesENFILEthe same way:I kept the raw
raw_os_error()check rather thanErrorKind::TooManyOpenFiles(#158326, which maps both) to match the rest of this probe, but can switch if
you'd prefer.
I didn't add a test, since triggering it needs real fd exhaustion during the
probe, which isn't practical to reproduce. The
EMFILEarm isn't tested either.r? libs