Integrated: 8315576: compiler/codecache/CodeCacheFullCountTest.java fails after JDK-8314837

Yi-Fan Tsai duke at openjdk.org
Fri Sep 22 08:00:22 UTC 2023


On Wed, 6 Sep 2023 21:54:24 GMT, Yi-Fan Tsai <duke at openjdk.org> wrote:

> CodeCacheFullCountTest disables code cache flushing, and loads classes to fill up the code cache.
> 
> The test expected two scenarios:
> 1. The compilers are disabled, adapters could still be created, and the process continues and terminates normally.
> 2. The adapters cannot be allocated and VirtualMachineError has been thrown and printed to stderr in `ThreadGroup.uncaughtException`.
> 
> When the test runs with option `-Xcomp`, `-esa`, and `-XX:-TieredCompilation`, more codes are compiled and the code cache becomes full earlier. Two more scenarios are found:
> 
> 3. The adapters cannot be allocated during initialization of VM. The error message is printed to tty/stdout (`vm_exit_during_initialization` in `Method::make_adapters`) rather than stderr. (This is scenario of the bug report on windows-x64.)
> 4. The adapters could not be allocated, and an VirtualMachineError was thrown and wrapped in other exceptions. The nested exceptions could not be printed by `printStackTrace` in `ThreadGroup.uncaughtException` while the code cache is full. Another VirtualMachineError was thrown and eventually printed by `JavaThread::exit` without its message. (This scenario was found with the same options of the bug report on linux-x64.)
> 
> More details of an example of scenario 4: the adapters could not be allocated in `loadClass`, and an VirtualMachineError was thrown and wrapped in LambdaConversionException in `InnerClassLambdaMetafactory.buildCallSite` and then BootstrapMethodError in `BootstrapMethodInvoker.invoke`. Printing these chained Throwable's in `ThreadGroup.uncaughtException` causes another VirtualMachineError thrown by `java.lang.StackTraceElement`. 
> 
>  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=
> OpenJDK 64-Bit Server VM warning: C2 initialization failed. Shutting down all compilers
> Exception in thread "main" java.lang.BootstrapMethodError: bootstrap method initialization exception
> 
> Exception: java.lang.VirtualMachineError thrown from the UncaughtExceptionHandler in thread "main"
> ]
> 
> 
> This change handles scenario 3 by checking the message in both stdout and stderr, and handles scenario 4 by exposing the root cause of VirtualMachineError. The second part is similar to  `CodeCacheOverflowProcessor.isThrowableCausedByVME` but without calling `String.matches` while code cache is full.
> 
> The test has passed as below.
> 
> make test \
>     TEST=...

This pull request has now been integrated.

Changeset: 343cc0ce
Author:    Yi-Fan Tsai <yftsai at amazon.com>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/343cc0ce2bba797e206f6b7312018a8c6d1bdb66
Stats:     15 lines in 2 files changed: 8 ins; 2 del; 5 mod

8315576: compiler/codecache/CodeCacheFullCountTest.java fails after JDK-8314837

Reviewed-by: kvn, thartmann

-------------

PR: https://git.openjdk.org/jdk/pull/15604


More information about the hotspot-compiler-dev mailing list