JDK-8064556 : G1: ParallelGCThreads=0 may cause assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current())) failed: Should be empty
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u40
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-11-11
  • Updated: 2015-01-21
  • Resolved: 2014-11-12
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 8
8u40 b16Fixed
Related Reports
Relates :  
Description
After JDK-8056240 JDK 8u40 may crash during G1's concurrent mark phase if ParallelGCThreads=0:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/jprt/T/P1/172752.amurillo/s/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp:5231), pid=19641, tid=3810052976
#  assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current())) failed: Should be empty
#
# JRE version: Java(TM) SE Runtime Environment (8.0_40) (build 1.8.0_40-internal-fastdebug-201411071727.amurillo.hs25-40-b18-snapsh-b00)
# Java VM: Java HotSpot(TM) Client VM (25.40-b18-fastdebug compiled mode linux-x86 )
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0xf66ecc00):  VMThread [stack: 0xe310c000,0xe318d000] [id=19647]

Stack: [0xe310c000,0xe318d000],  sp=0xe318b740,  free space=509k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x9d9f5b]  VMError::report_and_die()+0x17b
V  [libjvm.so+0x389118]  report_vm_error(char const*, int, char const*, char const*)+0x68
V  [libjvm.so+0x41e116]  G1ParallelCleaningTask::work(unsigned int)+0x46
V  [libjvm.so+0x40880a]  G1CollectedHeap::parallel_cleaning(BoolObjectClosure*, bool, bool, bool)+0x20a
V  [libjvm.so+0x336ae7]  ConcurrentMark::weakRefsWorkParallelPart(BoolObjectClosure*, bool)+0x27
V  [libjvm.so+0x34172f]  ConcurrentMark::weakRefsWork(bool)+0x6ef
V  [libjvm.so+0x34190b]  ConcurrentMark::checkpointRootsFinal(bool)+0xdb
V  [libjvm.so+0x376b44]  CMCheckpointRootsFinalClosure::do_void()+0x14
V  [libjvm.so+0xa05b03]  VM_CGC_Operation::doit()+0xd3
V  [libjvm.so+0xa0407a]  VM_Operation::evaluate()+0x9a
V  [libjvm.so+0xa016f4]  VMThread::evaluate_operation(VM_Operation*)+0x124
V  [libjvm.so+0xa021ca]  VMThread::loop()+0x65a
V  [libjvm.so+0xa02441]  VMThread::run()+0xc1
V  [libjvm.so+0x821279]  java_start(Thread*)+0x119
C  [libpthread.so.0+0x6a49]

VM_Operation (0xe39ff2c8): CGC_Operation, mode: safepoint, requested by thread 0xf663e400


Note that you can't use ParallelGCThreads=0 & G1GC w/ latest JDK 9 builds. 
Comments
Thanks for the report I know what the problem is. The pre_work_verification checks assume that the code is run in one of the worker threads. But with ParallelGCThreads == 0, this work is done by the VMThread, which will have a populated buffer. In JDK 9 you can't run G1 with ParallelGCThreads=0 and for JDK 8u we plan to use the ParallelGCThreads=1 code when specifying ParallelGCThreads=0.
11-11-2014

Issue could be reproduced w/ test gc/8000311/Test8000311.java: jdk/bin/java -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ResizePLAB -XX:ParallelGCThreads=0 Test8000311
11-11-2014