Skip to content
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

8284900: Check InitialHeapSize and container memory limits before startup #8256

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ public static void main(String[] args) throws Exception {
testMemorySoftLimit("500m", "524288000");
testMemorySoftLimit("1g", "1073741824");

testMemorySwapLimit("100m", "100m");

// Add extra 10 Mb to allocator limit, to be sure to cause OOM
testOOM("256m", 256 + 10);

@@ -175,4 +177,17 @@ private static void testOperatingSystemMXBeanAwareness(String memoryAllocation,
}
}

private static void testMemorySwapLimit(String dockerMemSwapLimit, String initialHeapSize) throws Exception {
Common.logNewTestCase("Check initial heap size with memory and swap limit");

DockerRunOptions opts = Common.newOpts(imageName, "CheckInitialHeapSize")
.addDockerOpts("--memory", dockerMemSwapLimit, "--memory-swap", dockerMemSwapLimit)
.addJavaOptsAppended("-Xms" + initialHeapSize);

OutputAnalyzer out = DockerTestUtils.dockerRunJava(opts);
out.shouldContain("Error occurred during initialization of VM")
.shouldContain("Initial heap size set to a larger value than the container memory & swap limit");

}

}