JDK-6450362 : Crash in heap inspection using jmap -histo
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-07-19
  • Updated: 2012-02-02
  • Resolved: 2006-08-02
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 6
6 b94Fixed
Related Reports
Relates :  
Relates :  
Description
The following unit test is failing with fastdebug builds when the through-put collector (-XX:+UseParallelGC) is used.

    sun/tools/jmap/Basic.sh

The test exercises the heap inspection code using the jmap -histo option. With a fastdebug build and -XX:+UseParallelGC the assertion is:

#
# An unexpected error has been detected by Java Runtime Environment:
#
#  Internal Error (/BUILD_AREA/jdk6.0/hotspot/src/share/vm/memory/heapInspection.cpp, 111 [ Patched ]), pid=29541, tid=5
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0-rc-fastdebug-b91-debug mixed mode)
#
# Error: assert(Universe::heap()->is_in_permanent((HeapWord*)p),"all klasses in permgen")
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

So far I've been unable to duplicate this with +PrintClassHistogram.

Comments
SUGGESTED FIX ------- heapInspection.cpp ------- *** /tmp/sccs.UqayAt Wed Jul 19 19:07:42 2006 --- heapInspection.cpp Wed Jul 19 19:00:10 2006 *************** *** 196,201 **** --- 196,204 ---- ResourceMark rm; HeapWord* ref; + assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped"); + assert(Heap_lock->is_locked(), "should have the Heap_lock"); + CollectedHeap* heap = Universe::heap(); switch (heap->kind()) { case CollectedHeap::GenCollectedHeap: { *************** *** 217,222 **** --- 220,229 ---- // Iterate over objects in the heap KlassInfoTable cit(KlassInfoTable::cit_size, ref); RecordInstanceClosure ric(&cit); + + // Ensure the heap is parseable + Universe::heap()->ensure_parseability(); + Universe::heap()->object_iterate(&ric); // Sort and print klass instance info
19-07-2006

EVALUATION Since b91 "jmap -histo <pid>" doesn't trigger a full GC in the target VM (need to use "jmap -histo:live <pid>" to trigger a full GC). This exposes a bug in the heap inspection code as it doesn't ensure the heap is parseable (doesn't fill TLABs). Trivial but very important to fix this by GA.
19-07-2006