← Back to team overview

openjdk team mailing list archive

[Bug 574997] Re: jmap memory mapping tool is broken due to aggressive stripping of libjvm.so

 

** Changed in: openjdk-6 (Ubuntu)
       Status: New => In Progress

-- 
jmap memory mapping tool is broken due to aggressive stripping of libjvm.so
https://bugs.launchpad.net/bugs/574997
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-6 in ubuntu.

Status in “openjdk-6” package in Ubuntu: In Progress

Bug description:
1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu.
Description:	Ubuntu 9.10
Release:	9.10

2) The version of the package you are using, via 'apt-cache policy packagename' or by checking in Synaptic.
openjdk-6-jre:
  Installed: 6b16-1.6.1-3ubuntu3
  Candidate: 6b16-1.6.1-3ubuntu3
  Version table:
 *** 6b16-1.6.1-3ubuntu3 0
        999 http://security.ubuntu.com karmic-security/main Packages
        999 http://security.ubuntu.com karmic-updates/main Packages
        100 /var/lib/dpkg/status
     6b16-1.6.1-1ubuntu3 0
        999 http://fi.archive.ubuntu.com karmic/main Packages

3) What you expected to happen
You can get memory map dump of a JVM instance with jmap tool, see http://java.sun.com/javase/6/docs/technotes/tools/share/jmap.html. However, this is broken in openjdk-6 in karmic and probably lucid too, because there was no indication about the fix in changelog.

Example with Sun JDK 1.6.0_20-b02 which works correctly.

(11:18:18)(tj@pink-piggy)(~/Desktop/tcpmon-1.0-bin/build)$ jps
1700 TCPMon
1764 Jps
(11:18:12)(tj@pink-piggy)(~/Desktop/tcpmon-1.0-bin/build)$ jmap -heap 1700
Attaching to process ID 1700, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 16.3-b01

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 922746880 (880.0MB)
   NewSize          = 5439488 (5.1875MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 88080384 (84.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
   capacity = 17301504 (16.5MB)
   used     = 15400960 (14.6875MB)
   free     = 1900544 (1.8125MB)
   89.01515151515152% used
Eden Space:
   capacity = 15400960 (14.6875MB)
   used     = 15400960 (14.6875MB)
   free     = 0 (0.0MB)
   100.0% used
>From Space:
   capacity = 1900544 (1.8125MB)
   used     = 0 (0.0MB)
   free     = 1900544 (1.8125MB)
   0.0% used
To Space:
   capacity = 1900544 (1.8125MB)
   used     = 0 (0.0MB)
   free     = 1900544 (1.8125MB)
   0.0% used
tenured generation:
   capacity = 38404096 (36.625MB)
   used     = 0 (0.0MB)
   free     = 38404096 (36.625MB)
   0.0% used
Perm Generation:
   capacity = 21757952 (20.75MB)
   used     = 13456432 (12.833053588867188MB)
   free     = 8301520 (7.9169464111328125MB)
   61.84604139213102% used

4) What happened instead
Here's what happens with Ubuntu's broken openjdk-6:

(11:20:36)(tj@pink-piggy)(~/Desktop/tcpmon-1.0-bin/build)$ jps
1883 Jps
1863 TCPMon
(11:20:38)(tj@pink-piggy)(~/Desktop/tcpmon-1.0-bin/build)$ jmap 1863
Attaching to process ID 1863, please wait...
sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypeEntryTypeNameOffset" in any of the known library names (libjvm.so, libjvm_g.so, gamma_g)
	at sun.jvm.hotspot.HotSpotTypeDataBase.lookupInProcess(HotSpotTypeDataBase.java:390)
	at sun.jvm.hotspot.HotSpotTypeDataBase.getLongValueFromProcess(HotSpotTypeDataBase.java:371)
	at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:102)
	at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:85)
	at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:568)
	at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:494)
	at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:332)
	at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
	at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at sun.tools.jmap.JMap.runTool(JMap.java:196)
	at sun.tools.jmap.JMap.main(JMap.java:128)
Debugger attached successfully.
sun.jvm.hotspot.tools.HeapSummary requires a java VM process/core!

The problem is that some needed symbols are stripped from libjvm.so. Installing openjdk-6-dbg package doesn't fix the issue and you shouldn't need this huge package anyway for the functionality.

This bug has been encountered by RedHat, Fedora and OpenSUSE communities and fixed in corresponding distros already. See the comments in the following bug entries for more info.

https://bugzilla.redhat.com/show_bug.cgi?id=530402
https://bugzilla.redhat.com/show_bug.cgi?id=541548
https://bugzilla.novell.com/show_bug.cgi?id=530046