JDK-8313901 : [TESTBUG] test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java fails with java.lang.VirtualMachineError
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-07
  • Updated: 2024-08-09
  • Resolved: 2023-08-23
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 JDK 21 JDK 22
11.0.25-oracleFixed 17.0.13-oracleFixed 21.0.1Fixed 22 b12Fixed
Related Reports
Relates :  
Description
We observed test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java failures sometimes due to `java.lang.VirtualMachineError: Out of space in CodeCache for adapters`. The stdout contains ` full_count=1` (test expects non-zero full_count):

stdout: [[0.195s][warning][codecache] CodeCache is full. Compiler has been disabled.
[0.195s][warning][codecache] Try increasing the code cache size using -XX:ReservedCodeCacheSize=
CodeCache: size=2496Kb used=2495Kb max_used=2495Kb free=0Kb
 bounds [0x00007f122c413000, 0x00007f122c683000, 0x00007f122c683000]
 total_blobs=765 nmethods=25 adapters=654
 compilation: disabled (not enough contiguous free space left)
              stopped_count=0, restarted_count=0
 full_count=1
];
 stderr: [OpenJDK 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled.
OpenJDK 64-Bit Server VM warning: Try increasing the code cache size using -XX:ReservedCodeCacheSize=
Exception in thread "main" java.lang.VirtualMachineError: Out of space in CodeCache for adapters

Exception: java.lang.VirtualMachineError thrown from the UncaughtExceptionHandler in thread "main"
]
 exitValue = 1

java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
	at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:490)
	at CodeCacheFullCountTest.runTest(CodeCacheFullCountTest.java:60)
	at CodeCacheFullCountTest.main(CodeCacheFullCountTest.java:43)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1570)
Comments
[jdk17u-fix-request] Approval Request from Amos "Backporting for parity with 17.0.13-oracle. No risk, test fix. Clean backport. Test passes and SAP nightlies pass on 2024-08-07”
08-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/2769 Date: 2024-08-01 20:58:25 +0000
01-08-2024

Fix Request (21u) Stabilizes the test. Applies cleanly. Multiple iterations of test pass.
24-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/84 Date: 2023-08-23 06:21:39 +0000
23-08-2023

Changeset: d1de3d08 Author: Kimura Yukihiro <kimura.yukihiro@jp.fujitsu.com> Committer: Aleksey Shipilev <shade@openjdk.org> Date: 2023-08-23 06:04:28 +0000 URL: https://git.openjdk.org/jdk/commit/d1de3d082ef9b83aaa68664e653ab09feb8bad87
23-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15329 Date: 2023-08-17 10:48:49 +0000
17-08-2023

Thanks for the update, that sounds good to me.
17-08-2023

I would like to fix this issue. As in the comments, I'm going to add a assert statement to warn creation failure of adapters. I discussed this point with myano who added the test, and we concluded that this fix was the best, as it is difficult to control the test avoiding running out of adapters all the time. I would appreciate it if you could let me know if you have any questions or concerns.
17-08-2023

+1 on changing the test to handle the exit value != 0 case. Thanks for looking into this.
08-08-2023

This is intermittent because the creation of adapters depends on class loading which depends on other factors like java agents or Graal running. I think the test should simply handle the exit value != 0 case and assert that we failed to create adapters. [~myano], you added the test with JDK-8277042, could you please have a look?
08-08-2023

ILW = Test fails because it does not correctly handle OOMEs in the code cache, intermittent with single test, no workaround = MLH = P4
08-08-2023