Repository navigation
Conversation
Signed-off-by: PerryLink <[email protected]>
This branch has not been deployed
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.
What
ProcessCollector.collect()reads/proc/<pid>/limitsand only assignsmax_fdswhen it finds theMax open fileline, but then uses it unconditionally:If the file opens but the line is not there — seen in the wild with a corrupted
Max open fidesheader (
home-assistant/core#140045, traceback atprocess_collector.py:93) — the collector raisesUnboundLocalError, and becausePROCESS_COLLECTORis registered in the defaultREGISTRYwithauto_describe=True,/metricsitself fails.The change
Bind
max_fdstoNonebefore the loop, append it only when it was found, and keep the existingOSErrorguard as-is. No new validation: the metric is simply omitted when the kernel does notreport it, which is what happens on every platform without
/procalready.Adds a regression test using the repository's existing fixture convention, with a
limitsfile thathas no
Max open fileline.Verification
python -m unittest tests.test_process_collector→UnboundLocalError: cannot access local variable 'max_fds'atprocess_collector.py:93(reproduced on Windows/Python 3.12.14 and onWSL2/Linux/Python 3.12.3);
pre-existing Windows-only warnings that the unmodified file reports too.
The adjacent
float('unlimited')issue (#80/#383) is deliberately not bundled here.DCO: commit is signed off.