-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8260349: Cannot programmatically retrieve Metaspace max set via JAVA_TOOL_OPTIONS #2275
Conversation
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
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.
The fix looks right. I suggest polishing the test a little.
import java.io.PrintWriter; | ||
import java.lang.management.ManagementFactory; | ||
import java.lang.management.MemoryPoolMXBean; | ||
|
||
import jdk.test.lib.process.ProcessTools; | ||
import jdk.test.lib.process.OutputAnalyzer; | ||
|
||
/* | ||
* @test | ||
* @bug 8260349 | ||
* @summary test that setting via the env-var and options file shows up as expected | ||
* @library /test/lib | ||
* @run driver MaxMetaspaceSizeEnvVarTest | ||
*/ |
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.
I believe the conventional style is to do jtreg test definition the first thing, and then do imports.
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.
Thanks for the Review Aleksey - note I just updated the test with a missing test case.
I'm not aware of a specific convention here. :) I used the existing MaxMetaspaceSizeTest.java in the same directory as the template for this one. But I can change it if you insist.
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.
Please change if you are doing the test touchups anyway.
test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java
Outdated
Show resolved
Hide resolved
@dholmes-ora 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
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.
Good. Minor nits to fix before push?
test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java
Outdated
Show resolved
Hide resolved
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 David,
this looks fine to me. Some nits below, but feel free to ignore them. Thanks for fixing this.
..Thomas
return FLAG_IS_CMDLINE(MaxMetaspaceSize) ? MaxMetaspaceSize : | ||
MemoryUsage::undefined_size(); | ||
return !FLAG_IS_DEFAULT(MaxMetaspaceSize) ? MaxMetaspaceSize : | ||
MemoryUsage::undefined_size(); |
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.
Somewhat more robust may be to compare against max_uint. In case we ever change the default to not be infinite. But I am fine with this too.
} | ||
|
||
public static void main(String... args) throws Exception { | ||
final String max = String.valueOf(9 * 1024 * 1024); // 9 MB |
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.
You could set this to a much larger value for this test, since it won't change how the test works and would not cause more footprint. Does not matter here but may matter if we ever backport this, since before jep387 initial metaspace usage was a lot higher (400K vs 5-6m).
Mailing list message from David Holmes on hotspot-runtime-dev: Hi Thomas, Thanks for taking a look at this. On 28/01/2021 9:33 pm, Thomas Stuefe wrote:
I'll leave it as is.
Actually the 9MB was selected because I found that on earlier versions Thanks again. |
/integrate |
@dholmes-ora Pushed as commit b6a7367. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
A simple but long standing bug whereby the MemoryPool MXBean only sees the value of MaxMetaspaceSize if it was set directly on the command-line and not by other means (e.g. env var).
Fix is to check !FLAG_IS_DEFAULT rather than FLAG_IS_CMDLINE.
Expanded regression test added (based on the reproducer in the JBS issue) that checks all the ways to set the flag: cmd-line, env-var, hotspotrc file
Testing: regression test (before and after fix)
tiers 1-3 (in progress)
Thanks,
David
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2275/head:pull/2275
$ git checkout pull/2275