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
JDK-8261167: print_process_memory_info add a close call after fopen #2409
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
Webrevs
|
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.
LGTM
@MBaesken This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 11 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
src/hotspot/os/linux/os_linux.cpp
Outdated
) | ||
{ | ||
num_found ++; | ||
if (f) { |
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.
Please don't use implied booleans. This should be:
if (f != NULL) {
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.
What Dan said. Plus if you are now checking the fopen succeeded shouldn't you also print something if it failed?
Thanks,
David
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.
hi Daniel and David, I added a NULL check, and some output.
I noticed that a number of other fopen calls miss the NULL check + output in case of failure as well, should I adjust that in another change?
Best regards, Matthias
src/hotspot/os/linux/os_linux.cpp
Outdated
) | ||
{ | ||
num_found ++; | ||
if (f) { |
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.
What Dan said. Plus if you are now checking the fopen succeeded shouldn't you also print something if it failed?
Thanks,
David
Mailing list message from David Holmes on hotspot-runtime-dev: On 5/02/2021 6:08 pm, Matthias Baesken wrote:
I guess so. Though the output will depend on context - some things you I'm trying to recall if there was some discussion that these /proc open Cheers, |
Hi David, those other calls are checked but just in the style if (fp) { ... } jdk/src/hotspot/os/linux/os_linux.cpp Line 1032 in 78b0d32
|
/integrate |
@MBaesken Since your change was applied there have been 15 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 43ae0cf. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hello, there is an fopen call opening "proc/self/status" in print_process_memory_info in os_linux.cpp. This call should also have a corresponding fclose-call.
See also the Sonar finding ("Opened stream never closed. Potential resource leak") :
https://sonarcloud.io/project/issues?id=shipilev_jdk&open=AXck8BNvBBG2CXpcnaeA&resolved=false&severities=BLOCKER&types=BUG
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2409/head:pull/2409
$ git checkout pull/2409