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.