JDK-8038930 : G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-04-01
  • Updated: 2015-01-21
  • Resolved: 2014-04-16
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 JDK 9
8u40Fixed 9 b12Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet:

;; Using jvm: "/scratch/local/aurora/sandbox/sca/vmsqe/jdk/pit/2014-03-28-223133.amurillo.hs25-20-b08-jdk8u20-b08-control/fastdebug/linux-i586/jre/lib/i386/client/libjvm.so"
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/jprt/T/P1/223133.amurillo/s/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp:200), pid=11510, tid=4152347504
#  assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet
#
# JRE version: Java(TM) SE Runtime Environment (8.0) (build 1.8.0-internal-fastdebug-201403282231.amurillo.hs25-20-b08-jdk8u2-b00)
# Java VM: Java HotSpot(TM) Client VM (25.20-b08-fastdebug compiled mode, sharing linux-x86 )
# Core dump written. Default location: /scratch/local/aurora/sandbox/results/workDir/sanity/ExecuteInternalVMTests/core or core.11510
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

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

Current thread (0xf660a800):  JavaThread "main" [_thread_in_vm, id=11513, stack(0xf77ac000,0xf77fd000)]

Stack: [0xf77ac000,0xf77fd000],  sp=0xf77fb0b0,  free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x99fb75]  VMError::report_and_die()+0x185;;  VMError::report_and_die()+0x185
V  [libjvm.so+0x3774d8]  report_vm_error(char const*, int, char const*, char const*)+0x68;;  report_vm_error(char const*, int, char const*, char const*)+0x68
V  [libjvm.so+0x3e6046]  G1CodeRootSet::test()+0x726;;  G1CodeRootSet::test()+0x726
V  [libjvm.so+0x574f13]  execute_internal_vm_tests()+0x1c3;;  execute_internal_vm_tests()+0x1c3
V  [libjvm.so+0x576c8a]  JNI_CreateJavaVM+0x1ba;;  JNI_CreateJavaVM+0x1ba
C  [libjli.so+0x72a8]  JavaMain+0x98;;  JavaMain+0x98
C  [libpthread.so.0+0x6a49]
C  [libc.so.6+0xdee1e]  clone+0x5e

Issue could be reproduced when VM started with -XX:+UseG1GC and -Xcomp, but nothing bad happens when -Xmixed is used.

Test make assumption that there are no chunks in use, however this assumption fails if some nmethods where registered before ::test execution.
Comments
There is another race with the compiler that is problematic: if the compiler is running while the test executes, several assumptions do not hold either.
14-04-2014

I = Bug in test code, only in debug build -> L L = Test failes everytime with debug builds + G1 + Xcomp -> H W = Don't use G1 or Xcomp -> H LHH= P4
02-04-2014

This is a test bug: it assumes that no code has been compiled yet. However the internal VM tests are started after the VM has been started up, and with -Xcomp parts of it compiled already. This can add references to the code roots, handing out code root chunks in the process.
01-04-2014