JDK-8235751 : Assertion when triggering concurrent cycle during shutdown
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 14
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-12-11
  • Updated: 2020-01-31
  • Resolved: 2020-01-07
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 14 JDK 15
14 b31Fixed 15Fixed
Related Reports
Relates :  
Description
If using jcmd to trigger concurrent cycles (VM is started with -XX:+ExplicitGCInvokesConcurrent) we will hit this assertion if the request is done after the concurrent mark thread is shutdown:
#  Internal Error (open/src/hotspot/share/gc/g1/g1CollectedHeap.cpp:2207), pid=25508, tid=25636
#  assert(!op.gc_succeeded() || (old_marking_started_before != old_marking_started_after)) failed: invariant: succeeded true, started before 41, started after 41

The reason is that we in do_collection_pause_at_safepoint() realize we are about to shutdown and don't trigger a concurrent cycle, which leads to the counter not being incremented. 

VM_G1TryInitiateConcMark should be updated to handle this case.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk14/rev/6e51a868361e User: kbarrett Date: 2020-01-07 22:47:24 +0000
07-01-2020

Reproducer from StefanK: while make -C ../build/fastdebug test TEST=test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/Zombie.java JTREG="RETAIN=all;VERBOSE=all;JAVA_OPTIONS=-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -Xmx4m -Xlog:gc -XX:+ExplicitGCInvokesConcurrent"; do date; done From another shell run: while true; do jcmd com.sun.javatest.regtest.agent.MainWrapper GC.run; done To trigger this faster I added a naked_short_sleep like this: diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -538,7 +538,7 @@ // though we no longer know what that path may be. ((JavaThread*)thread)->set_thread_state(_thread_in_vm); } - + os::naked_short_sleep(999); // Fire off a VM_Exit operation to bring VM to a safepoint and exit VM_Exit op(code);
11-12-2019