JDK-8248265 : compiler/ciReplay tests fail with AOT compiled java.base
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 15,16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2020-06-24
  • Updated: 2021-03-15
  • Resolved: 2020-06-30
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 15 JDK 16
11.0.12-oracleFixed 15 b30Fixed 16Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8248335 :  
Description
The following tests failed in the JDK15 CI:

compiler/ciReplay/TestVMNoCompLevel.java
compiler/ciReplay/TestServerVM.java

Here's a snippet from the TestVMNoCompLevel.java log file:

----------System.err:(20/1465)----------
java.lang.Error: Can't create replay: java.lang.RuntimeException: Crash JVM exits gracefully: expected 0 to not equal 0
	at compiler.ciReplay.CiReplayBase.generateReplay(CiReplayBase.java:156)
	at compiler.ciReplay.CiReplayBase.runTest(CiReplayBase.java:103)
	at compiler.ciReplay.TestVMNoCompLevel.main(TestVMNoCompLevel.java:48)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: Crash JVM exits gracefully: expected 0 to not equal 0
	at jdk.test.lib.Asserts.fail(Asserts.java:594)
	at jdk.test.lib.Asserts.assertNotEquals(Asserts.java:394)
	at compiler.ciReplay.CiReplayBase.generateReplay(CiReplayBase.java:151)
	... 8 more

JavaTest Message: Test threw exception: java.lang.Error: Can't create replay: java.lang.RuntimeException: Crash JVM exits gracefully: expected 0 to not equal 0
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.Error: Can't create replay: java.lang.RuntimeException: Crash JVM exits gracefully: expected 0 to not equal 0

TestServerVM.java fails in the same way.
Comments
Changeset: d5ae932b Author: Tobias Hartmann <thartmann@openjdk.org> Date: 2020-06-30 15:08:40 +0000 URL: https://git.openjdk.java.net/mobile/commit/d5ae932b
02-07-2020

URL: https://hg.openjdk.java.net/jdk/jdk15/rev/6e6e6635a970 User: thartmann Date: 2020-06-30 13:09:11 +0000
30-06-2020

Thanks Igor. I found the root cause: With AOT compiled java.base, we call EmptyMain::main through JavaCalls::call_helper(). The fix for JDK-8247992 restored the old behavior that empty methods are not called: https://hg.openjdk.java.net/jdk/jdk15/rev/94025f9e6a0d#l2.36 As a result, EmptyMain::main is not called and therefore also not compiled. The test fails because -XX:CICrashAt=1 triggers no VM crash. Empty methods not being called is expected behavior. Therefore, this is a test bug. Fix: http://cr.openjdk.java.net/~thartmann/8248265/webrev.00/
29-06-2020

note that the only used AOT library is libjava.base.so which doesn't contain any methods of CiReplayBase$EmptyMain, and given JVM is run w/ -Xcomp, I don't see any reasons for CiReplayBase$EmptyMain not to be compiled, and hence I don't think it's a test bug.
25-06-2020

judging by the absence of anything from PrintCompilation in the process log and hotspot_log file (both listed below), JVM didn't even try to compile CiReplayBase$EmptyMain. pid-21389-output.log: --- ProcessLog --- cmd: $datadir/jdk-15+29-1439/linux-x64-debug.jdk/jdk-15/fastdebug/bin/java -cp $workdir/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1/compiler/ciReplay/TestServerVM.d:$datadir/jdk-15+29-1439/src.full/open/test/hotspot/jtreg/compiler/ciReplay:$workdir/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1:$datadir/jdk-15+29-1439/src.full/open/test/hotspot/jtreg:$workdir/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1/test/lib:$datadir/jdk-15+29-1439/src.full/open/test/lib:$datadir/jtreg/5.1/b01/bundles/jtreg_bin-5.1.zip/jtreg/lib/javatest.jar:$datadir/jtreg/5.1/b01/bundles/jtreg_bin-5.1.zip/jtreg/lib/jtreg.jar -XX:MaxRAMPercentage=6 -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$workdir/./testoutput/test-support/aot/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/libjava.base.so -server -ea -esa -Xms128m -Xmx128m -XX:MetaspaceSize=4m -XX:MaxMetaspaceSize=16m -XX:InitialCodeCacheSize=512k -XX:ReservedCodeCacheSize=4m -XX:ThreadStackSize=512 -XX:VMThreadStackSize=512 -XX:CompilerThreadStackSize=512 -XX:ParallelGCThreads=1 -XX:CICompilerCount=2 -Xcomp -XX:CICrashAt=1 -XX:+DumpReplayDataOnError -XX:+PreferInterpreterNativeStubs -XX:+PrintCompilation -XX:ReplayDataFile=test_replay.txt -XX:-CreateCoredumpOnCrash compiler.ciReplay.CiReplayBase$EmptyMain exitvalue: 0 stderr: stdout: hotspot_pid21389.log: <?xml version='1.0' encoding='UTF-8'?> <hotspot_log version='160 1' process='21389' time_ms='1592974102596'> <vm_version> <name> Java HotSpot(TM) 64-Bit Server VM </name> <release> 15-ea+29-1439 </release> <info> Java HotSpot(TM) 64-Bit Server VM (fastdebug 15-ea+29-1439) for linux-amd64 JRE (15-ea+29-1439), built on Jun 23 2020 15:41:04 by &quot;mach5one&quot; with gcc 9.2.0 </info> </vm_version> <vm_arguments> <args> -XX:MaxRAMPercentage=6 -XX:+UnlockExperimentalVMOptions -XX:AOTLibrary=$workdir./testoutput/test-support/aot/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/libjava.base.so -ea -esa -Xms128m -Xmx128m -XX:MetaspaceSize=4m -XX:MaxMetaspaceSize=16m -XX:InitialCodeCacheSize=512k -XX:ReservedCodeCacheSize=4m -XX:ThreadStackSize=512 -XX:VMThreadStackSize=512 -XX:CompilerThreadStackSize=512 -XX:ParallelGCThreads=1 -XX:CICompilerCount=2 -Xcomp -XX:CICrashAt=1 -XX:+DumpReplayDataOnError -XX:+PreferInterpreterNativeStubs -XX:+PrintCompilation -XX:ReplayDataFile=test_replay.txt -XX:-CreateCoredumpOnCrash </args> <command> compiler.ciReplay.CiReplayBase$EmptyMain </command> <launcher> SUN_STANDARD </launcher> <properties> java.vm.specification.name=Java Virtual Machine Specification java.vm.version=15-ea+29-1439 java.vm.name=Java HotSpot(TM) 64-Bit Server VM jdk.debug=fastdebug sun.boot.library.path=$datadirjdk-15+29-1439/linux-x64-debug.jdk/jdk-15/fastdebug/lib java.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib java.home=$datadirjdk-15+29-1439/linux-x64-debug.jdk/jdk-15/fastdebug java.class.path=$workdirtestoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1/compiler/ciReplay/TestServerVM.d:$datadirjdk-15+29-1439/src.full/open/test/hotspot/jtreg/compiler/ciReplay:$workdirtestoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1:$datadirjdk-15+29-1439/src.full/open/test/hotspot/jtreg:$workdirtestoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_compiler_all_gcs/classes/1/test/lib:$datadirjdk-15+29-1439/src.full/open/test/lib:$datadirjtreg/5.1/b01/bundles/jtreg_bin-5.1.zip/jtreg/lib/javatest.jar:$datadirjtreg/5.1/b01/bundles/jtreg_bin-5.1.zip/jtreg/lib/jtreg.jar jdk.boot.class.path.append= java.vm.info=compiled mode, sharing java.vm.specification.vendor=Oracle Corporation java.vm.specification.version=15 java.vm.vendor=Oracle Corporation sun.java.command=compiler.ciReplay.CiReplayBase$EmptyMain sun.java.launcher=SUN_STANDARD </properties> </vm_arguments> <tty> <writer thread='21392'/> <blob name='MethodHandlesAdapterBlob' size='182000'> <sect index='1' size='182000' free='179994'/> </blob> C1 Runtime statistics: _resolve_invoke_virtual_cnt: 518 _resolve_invoke_opt_virtual_cnt: 406 _resolve_invoke_static_cnt: 338 _handle_wrong_method_cnt: 0 _ic_miss_cnt: 77 _generic_arraycopy_cnt: 0 _generic_arraycopystub_cnt: 0 _byte_arraycopy_cnt: 0 _short_arraycopy_cnt: 0 _int_arraycopy_cnt: 0 _long_arraycopy_cnt: 0 _oop_arraycopy_cnt: 0 _arraycopy_slowcase_cnt: 0 _arraycopy_checkcast_cnt: 0 _arraycopy_checkcast_attempt_cnt:0 _new_type_array_slowcase_cnt: 0 _new_object_array_slowcase_cnt: 0 _new_instance_slowcase_cnt: 0 _new_multi_array_slowcase_cnt: 0 _monitorenter_slowcase_cnt: 0 _monitorexit_slowcase_cnt: 0 _patch_code_slowcase_cnt: 0 _throw_range_check_exception_count: 0: _throw_index_exception_count: 0: _throw_div0_exception_count: 0: _throw_null_pointer_exception_count: 0: _throw_class_cast_exception_count: 0: _throw_incompatible_class_change_error_count: 0: _throw_array_store_exception_count: 0: _throw_count: 0: <statistics type='SharedRuntime'> 77 inline cache miss in compiled 0 wrong method 338 unresolved static call site 518 unresolved virtual call site 406 unresolved opt virtual call site 233 byte array copies 12 short array copies 50 int array copies 12 long array copies 36 generic array copies AdapterHandlerTable: empty 226 longest 4 total 77 average 1.149254 AdapterHandlerTable: lookups 778 buckets 39 equals 25 hits 25 compact 25 </statistics> <statistics type='opto'> --- Compiler Statistics --- Methods seen: 0 Methods parsed: 0 Nodes created: 1441 Blocks parsed: 0 Blocks seen: 0 0 made implicit ( 0%) CCP: 0 constants found: 0 Total frameslots = 8, Max frameslots = 4 Inserted 0 spill loads, 0 spill stores, 0 mem-mem moves and 0 copies. Total load cost= 0, store cost = 0, mem-mem cost = 0.00, copy cost = 0. Adjusted spill cost = 0. Conservatively coalesced 36 copies, 0 pairs, 0 post alloc. Average allocation trips 1.000000 High Pressure Blocks = 0, Low Pressure Blocks = 0 Nops added 0 bytes to total of 1272 bytes, for 0.00% Peephole: peephole rules applied: 0 PhaseIdealLoop=0, sum _unique=0 </statistics> <writer thread='21406'/> <destroy_vm stamp='0.178'/> <tty_done stamp='0.194'/> </tty> <hotspot_log_done stamp='0.194'/> </hotspot_log>
25-06-2020

The test tries to trigger a crash on first compilation via -XX:CICrashAt=1 but since we are running with AOT, no compilation seems to be triggered. Marking this as test bug for now. This should have been fixed by old JDK-8150757, [~iignatyev] could you please have a look?
25-06-2020