-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-99242 Catch OSError when calling getloadavg in libregrtest #106705
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
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Misc/NEWS.d/next/Tests/2023-07-13-02-14-57.gh-issue-99242.DHVhbD.rst
Outdated
Show resolved
Hide resolved
…bD.rst Co-authored-by: Charlie Zhao <zhaoyu_hit@qq.com>
return os.getloadavg()[0] | ||
try: | ||
return os.getloadavg()[0] | ||
except OSError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The raised exception does not have any other information that .args == ('Load averages are unobtainable',)
, so it's ok if we don't inspect it more to make sure we're catching only the issue at hand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on a CentOS 7.9 chroot without /proc
mounted. On newer OSs /proc
is not used but a syscall sysinfo()
.
Merged in #121663. Thank you for the fix! |
Per suggestions in the comments for #99242 I added a try/except around the call to
os.getloadavg
.Perhaps a logged warning here is appropriate as well?