8224502: [TESTBUG] JDK docker test TestSystemMetrics.java fails with access issues and OOM
authorbobv
Mon, 24 Jun 2019 11:49:59 -0400
changeset 55484 1cd4d287839b
parent 55483 00c08fae63e8
child 55485 1e4bbd6fbb2f
8224502: [TESTBUG] JDK docker test TestSystemMetrics.java fails with access issues and OOM Reviewed-by: sgehwolf, mseledtsov
test/jdk/ProblemList.txt
test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java
test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
--- a/test/jdk/ProblemList.txt	Mon Jun 24 10:11:17 2019 -0400
+++ b/test/jdk/ProblemList.txt	Mon Jun 24 11:49:59 2019 -0400
@@ -878,4 +878,3 @@
 # jdk/internal/docker
 
 jdk/internal/platform/docker/TestDockerMemoryMetrics.java       8224506    generic-all
-jdk/internal/platform/docker/TestSystemMetrics.java             8224502    generic-all
--- a/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java	Mon Jun 24 10:11:17 2019 -0400
+++ b/test/jdk/jdk/internal/platform/docker/TestSystemMetrics.java	Mon Jun 24 11:49:59 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
             DockerRunOptions opts =
                     new DockerRunOptions(imageName, "/jdk/bin/java", "jdk.test.lib.containers.cgroup.MetricsTester");
             opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/");
+            opts.addDockerOpts("--memory=256m");
             opts.addJavaOpts("-cp", "/test-classes/");
             opts.addJavaOpts("--add-exports", "java.base/jdk.internal.platform=ALL-UNNAMED");
             DockerTestUtils.dockerRunJava(opts).shouldHaveExitValue(0).shouldContain("TEST PASSED!!!");
--- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Mon Jun 24 10:11:17 2019 -0400
+++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Mon Jun 24 11:49:59 2019 -0400
@@ -560,7 +560,7 @@
         long memoryMaxUsage = metrics.getMemoryMaxUsage();
         long memoryUsage = metrics.getMemoryUsage();
 
-        long[] ll = new long[64*1024*1024]; // 64M
+        byte[] bb = new byte[64*1024*1024]; // 64M
 
         long newMemoryMaxUsage = metrics.getMemoryMaxUsage();
         long newMemoryUsage = metrics.getMemoryUsage();