JDK-8261661 : gc/stress/TestReclaimStringsLeaksMemory.java fails because Reserved memory size is too big
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 11,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-02-12
  • Updated: 2021-11-29
  • Resolved: 2021-02-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17
11.0.14Fixed 17 b10Fixed
Related Reports
Relates :  
Description
The following test failed in the JDK17 CI:

gc/stress/TestReclaimStringsLeaksMemory.java

Here's a snippet from the log file:

----------System.err:(16/1150)----------
java.lang.RuntimeException: Reserved memory size is 4903968KB which is greater than or equal to 70000KB indicating a memory leak: expected that 4903968 < 70000
	at jdk.test.lib.Asserts.fail(Asserts.java:594)
	at jdk.test.lib.Asserts.assertLessThan(Asserts.java:99)
	at jdk.test.lib.Asserts.assertLT(Asserts.java:70)
	at gc.stress.TestReclaimStringsLeaksMemory.verifySymbolMemoryUsageNotTooHigh(TestReclaimStringsLeaksMemory.java:80)
	at gc.stress.TestReclaimStringsLeaksMemory.main(TestReclaimStringsLeaksMemory.java:65)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

JavaTest Message: Test threw exception: java.lang.RuntimeException
Comments
Fix Request We need this in 11 to fix this test error too, since 8261297: "NMT: Final report should use scale 1" - the culprit - has been backported. Fix does not apply cleanly due to copyright header changes, but is trivial. No risk. https://github.com/openjdk/jdk11u-dev/pull/672
29-11-2021

Changeset: 735757f1 Author: Daniel D. Daugherty <dcubed@openjdk.org> Date: 2021-02-12 22:41:08 +0000 URL: https://git.openjdk.java.net/jdk/commit/735757f1
12-02-2021

I was able to reproduce this failure on my MBP13 and this fix solves the failure mode: $ git diff diff --git a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java index 85d13bb2f46..2a02e155265 100644 --- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java +++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java @@ -48,9 +48,9 @@ import jdk.test.lib.process.ProcessTools; public class TestReclaimStringsLeaksMemory { - // The amount of memory in kB reserved in the "Symbol" category that indicates a memory leak for + // The amount of memory in B reserved in the "Symbol" category that indicates a memory leak for // this test. - public static final int ReservedThreshold = 70000; + public static final int ReservedThreshold = 70000000; public static void main(String[] args) throws Exception { ArrayList<String> baseargs = new ArrayList<>(Arrays.asList("-Xms256M", @@ -77,7 +77,7 @@ public class TestReclaimStringsLeaksMemory { } int reserved = Integer.parseInt(m.group(1)); - Asserts.assertLT(reserved, ReservedThreshold, "Reserved memory size is " + reserved + "KB which is greater than or equal to " + ReservedThreshold + "KB indicating a memory leak"); + Asserts.assertLT(reserved, ReservedThreshold, "Reserved memory size is " + reserved + "B which is greater than or equal to " + ReservedThreshold + "B indicating a memory leak"); output.shouldHaveExitValue(0); }
12-02-2021

Here's a Slack comment from [~ayang]: > https://github.com/openjdk/jdk/pull/2450 changed the report scaling, but > the test still treat the output as KB instead of byte. Change KB to byte in > the test fixes the failure on my box at least.
12-02-2021