JDK-8131734 : assert(!is_null(v)) failed: narrow klass value can never be zero with -Xshared:auto
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-07-16
  • Updated: 2016-04-01
  • Resolved: 2015-08-25
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 9
9 b83Fixed
Related Reports
Relates :  
Description
If the VM fails to map the shared string region, with -Xshared:auto it disables sharing and continues. There is an assertion failure in GC later on when it scans the "archived" region. The assertion failure was first discovered on Windows when I tried to enable the shared string support. The mapping of shared string region failed on Windows.

# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/klass.inline.hpp:63
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/export/users/jiangli/jdk9/hotspot/src/share/vm/oops/klass.inline.hpp:63), pid=30067, tid=0x00007fffdcf17700
#  assert(!is_null(v)) failed: narrow klass value can never be zero
#
# JRE version: Java(TM) SE Runtime Environment (9.0) (build 1.9.0-internal-debug-jianzhou_2015_06_08_16_34-b00)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.9.0-internal-debug-jianzhou_2015_07_16_18_42-b00 mixed mode linux-amd64 compressed oops)
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c" (or dumping to /export/users/jiangli/build-64/images/jdk/core.30067)
#
# An error report file with more information is saved as:
# /export/users/jiangli/build-64/images/jdk/hs_err_pid30067.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

#0  0x00007ffff7837445 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff783abab in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff66dfe3e in os::abort(bool, void*, void*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#3  0x00007ffff6925336 in VMError::report_and_die() ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#4  0x00007ffff610f7c5 in report_vm_error(char const*, int, char const*, char const*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#5  0x00007ffff5c16c79 in Klass::decode_klass_not_null(unsigned int) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#6  0x00007ffff5db0a79 in oopDesc::klass() const ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#7  0x00007ffff5f6d46d in oopDesc::oop_iterate(NoHeaderExtendedOopClosure*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#8  0x00007ffff5f6d42b in oopDesc::oop_iterate_no_header(OopClosure*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#9  0x00007ffff624c58a in VerifyArchiveRegionClosure::do_object(oopDesc*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#10 0x00007ffff6337ff1 in G1OffsetTableContigSpace::object_iterate(ObjectClosure*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#11 0x00007ffff624c6af in VerifyRegionClosure::doHeapRegion(HeapRegion*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#12 0x00007ffff633c989 in HeapRegionManager::par_iterate(HeapRegionClosure*, unsigned int, HeapRegionClaimer*, bool) const () from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#13 0x00007ffff6239a5d in G1CollectedHeap::heap_region_par_iterate(HeapRegionClosure*, unsigned int, HeapRegionClaimer*, bool) const () from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#14 0x00007ffff624c953 in G1ParVerifyTask::work(unsigned int) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#15 0x00007ffff69869f5 in GangWorker::loop() ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#16 0x00007ffff6986489 in GangWorker::run() ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#17 0x00007ffff66de545 in java_start(Thread*) ()
   from /export/users/jiangli/build-64/images/jdk/lib/amd64/server/libjvm.so
#18 0x00007ffff73e7e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#19 0x00007ffff78f34bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#20 0x0000000000000000 in ?? ()
Comments
Mapping the string region first doesn't feel like the right thing to do, anyway. First ensuring the address range is in the heap and not already in use seems more sensible. I'm adding a free_archive_regions call to G1 to support Xshare:auto.
04-08-2015

I tried mapping the shared string region before allocating the G1 archived region. The archived region allocation code zeros out the memory and the mapped data is lost.
20-07-2015

The fix is to release/free the archived region if mapping fails. Or map the shared string region before allocating the archived region in G1.
17-07-2015