-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8314940: Use of NIO in JDKs Metrics implementation causes issues in GraalVM #15416
Conversation
👋 Welcome back sgehwolf! A progress list of the required criteria for merging this PR into |
/cc serviceability-dev |
@jerboaa |
/label serviceability-dev |
@jerboaa The |
Something fishy here, is this working around a bug in GraaVM native image or why does this change need to be in JDK? |
I've now realized that the bug had an incorrect statement in the description. The cycle happens due to the With that said, it's seems a rather uncontroversial change with very limited scope. Do you see anything problematic in this patch? Happy to revise if you think there are some no-no's :) |
/contributor add pejovica |
@jerboaa Syntax:
User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address. |
/contributor add apejovic |
@jerboaa |
Recursive initialization issues can tricky and often it comes down to deciding where to break the cycle. In this case, it seems a bit fragile to do it in CgroupUtil as it should be allowed to use any of the file system APIs to access cgroups or proc files. Part of me wonders if this would be better handled in their implementation of jdk.internal.misc.VM or Runtime.maxMemory but maybe you've been there already? |
In theory, yes. It should be able to use any file system APIs. Practically, it doesn't make a whole lot of difference :-) Going by the last few years this area of the code hasn't had many updates.
Implementing This isn't a problem in OpenJDK (yet), since HotSpot has its own implementation in its runtime written in C. That has its own set of problems, since we need to update both implementations when bugs come in. In a way, this boils down to ByteBuffers using max heap size for it's default direct memory size determination. I'm not sure doing something else in GraalVM for determining the default direct memory size would be any better. All things considered, breaking the cycle in OpenJDK seems reasonable to me. Would this convince you to accept this patch? |
@AlanBateman Is there anything else you need me to do? If so, please let me know. Thanks! |
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.
Looks good to me. A comment would be nice, possibly above the imports, warning about using nio.
@jerboaa 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 67 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 |
I don't think the JDK is the right place to workaround this issue. Also, we really need to get back re-implementing FileInputStream and friends on the new API, in which case the original issue will come back again. So I think it would be better to see how this can be fixed in the native image code. |
OK. I understand. Withdrawing this PR then. |
Please review this rather trivial fix to not use
nio
inCgroupUtil
, part of theJDK's Metrics API. The primary motivating factor is that it allows one to use the
JDK's version of
Metrics
in GraalVM. See the bug for details as to why this isneeded.
Testing:
jdk/internal/platform
jtreg tests on Linux x86_64 (cgv1).Progress
Issue
Reviewers
Contributors
<apejovic@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15416/head:pull/15416
$ git checkout pull/15416
Update a local copy of the PR:
$ git checkout pull/15416
$ git pull https://git.openjdk.org/jdk.git pull/15416/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15416
View PR using the GUI difftool:
$ git pr show -t 15416
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15416.diff
Webrev
Link to Webrev Comment