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
8264524: jdk/internal/platform/docker/TestDockerMemoryMetrics.java fails due to swapping not working #3286
Conversation
/issue add JDK-8264524 |
|
…ils due to OOM killed
@DamonFool This issue is referenced in the PR title - it will now be updated. |
@DamonFool |
@DamonFool The |
Webrevs
|
OutputAnalyzer oa = DockerTestUtils.dockerRunJava(opts); | ||
String output = oa.getOutput(); | ||
if (output.contains("Not OOM killed")) { | ||
if (!output.contains("Ignoring test")) { | ||
oa.shouldHaveExitValue(0).shouldContain("TEST PASSED!!!"); | ||
} | ||
} |
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.
Consider a broken implementation of Metrics.systemMetrics().getMemoryFailCount()
. Wouldn't the test now (falsely) pass?
What is the actual test output on those systems where the test fails? There should be a docker log file. Does it enter line 91?
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 @jerboaa for your review.
Test output when failing is just:
[failcount]
It doesn't enter line 91 of test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java.
I assume memory.failcnt has been disabled on these platforms since it's always 0.
What about checking the value of memory.failcnt after testMemoryFailCount like:
// check after testMemoryFailCount()
if (memory.failcnt is zero) {
// memory.failcnt has been disabled
pass
} else {
// a broken implementation of Metrics.systemMetrics().getMemoryFailCount()
fail
}
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.
Hi @jerboaa ,
After more thinking, I think the reason why memory.failcnt is always 0 is that there is no swap space on the host machine.
So the testMemoryFailCount should be skipped in that case.
But is there any API which can be used to get the swap space size of the host machine?
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.
Consider a broken implementation of
Metrics.systemMetrics().getMemoryFailCount()
. Wouldn't the test now (falsely) pass?
Hi @jerboaa ,
A pre-test run has been added to check whether swapping really works for testMemoryFailCount.
Swapping should be OK for memory.failcnt testing otherwise it will fail due to OOM killed.
What do you think?
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.
@DamonFool Hmm, if swap not working is the issue the test shouldn't enter the branch which you say is failing. From MetricsMemoryTester.java
:
private static void testMemoryFailCount() {
long memAndSwapLimit = Metrics.systemMetrics().getMemoryAndSwapLimit();
long memLimit = Metrics.systemMetrics().getMemoryLimit();
// We need swap to execute this test or will SEGV
if (memAndSwapLimit <= memLimit) { // <=============== This is checking whether or not swap works
System.out.println("No swap memory limits, test case skipped");
} else {
It has been added with JDK-8250984. So now I'm even more confused what's going on here...
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.
if (memAndSwapLimit <= memLimit)
Hi @jerboaa ,
Unfortunately, this check fails to work on a host machine which doesn't support swapping (e.g., total size of Swap is 0 byte).
You can still specify --memory and --memory-swap as you like on a host machine without swapping space.
And Metrics.systemMetrics().getMemoryLimit()/getMemoryAndSwapLimit() do return the values as you specified.
But the swapping will never happen since there is no swapping space on the host machine.
Thanks.
@@ -102,6 +102,21 @@ private static void testMemoryLimit(String value) throws Exception { | |||
|
|||
private static void testMemoryFailCount(String value) throws Exception { | |||
Common.logNewTestCase("testMemoryFailCount" + value); | |||
|
|||
// Check whether swapping really works for this test |
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 explain what "swapping not working" actually means in this comment. One version of it is already handled via JDK-8250984 so this is sort-of ambiguous. Suggestion: "On some systems there is no swap space enabled. On those systems running java -version
??? with a memory limit fails due to swap space size being 0". Or something like that.
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 explain what "swapping not working" actually means in this comment.
Updated.
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.
LGTM.
@DamonFool This change now passes all automated pre-integration checks. 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 68 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.
|
Thanks @jerboaa for your review. |
@DamonFool Since your change was applied there have been 72 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit bfb034a. |
Hi all,
jdk/internal/platform/docker/TestDockerMemoryMetrics.java fails on some of our testing platforms.
This is because testMemoryFailCount [1] fails due to OOM killed.
This test fails to avoid OOM killed [2] if memory.failcnt is always 0.
The fix will print "Not OOM killed" if OOM killed doesn't happen.
And also fix another bug if the test get returned here [3].
Testing:
Thanks.
Best regards,
Jie
[1] https://github.com/openjdk/jdk/blob/master/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java#L80
[2] https://github.com/openjdk/jdk/blob/master/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java#L87
[3] https://github.com/openjdk/jdk/blob/master/test/jdk/jdk/internal/platform/docker/MetricsMemoryTester.java#L96
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3286/head:pull/3286
$ git checkout pull/3286
Update a local copy of the PR:
$ git checkout pull/3286
$ git pull https://git.openjdk.java.net/jdk pull/3286/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3286
View PR using the GUI difftool:
$ git pr show -t 3286
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3286.diff