jmap memory mapping tool is broken due to aggressive stripping of libjvm.so

Bug #574997 reported by Tuomas Jormola
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

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

Matthias Klose (doko)
Changed in openjdk-6 (Ubuntu):
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted openjdk-6 into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in openjdk-6 (Ubuntu Lucid):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-6 - 6b20~pre1-1ubuntu1

---------------
openjdk-6 (6b20~pre1-1ubuntu1) maverick; urgency=low

  * Include docs in the -doc package. LP: #600834.
  * Update from the IcedTea6 trunk.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
 -- Matthias Klose <email address hidden> Thu, 15 Jul 2010 12:40:10 +0200

Changed in openjdk-6 (Ubuntu Maverick):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-6 - 6b18-1.8-4ubuntu3

---------------
openjdk-6 (6b18-1.8-4ubuntu3) lucid-proposed; urgency=low

  * Update from the 1.8 branch.
  * Rebuild with fixed ant.
  * Disable building the shark based VM on armel.
  * Always build the ARM assembler interpreter in arm mode.

openjdk-6 (6b18-1.8-4) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin and netx fixes.
    - Don't link the plugin against the libxul libraries. Closes: #576361.
    - More plugin cpu usage fixes. Closes: #584335, #587049.
    - Plugin: fixes AppletContext.getApplets().
    - Fix race conditions in plugin initialization code that were causing
      hangs when loading multiple applets in parallel.
  * Fix Vcs-Bzr location. Closes: #530883.
  * Search for unversioned llvm-config tool.
  * Don't set XFILESEARCHPATH and NLSPATH on startup. LP: #586641.
  * Fix chinese font metrics and prefer using 'WenQuanYi Micro Hei' font.
    LP: #472845.
  * Strip libjvm.so with --strip-debug instead of --strip-unneeded.
    LP: #574997.
  * Don't turn on the ARM assembler interpreter when building the shark
    VM.

openjdk-6 (6b18-1.8-3) unstable; urgency=low

  * Update from the 1.8 branch.
    - Plugin fixes. LP: #597714.
  * Add powerpcspe build fixes (Sebastian Andrzej Siewior). Closes: #586359.
  * Work around build failure on buildds configured with low ARG_MAX
    (Giovanni Mascellani). Closes: #575254.
 -- Matthias Klose <email address hidden> Fri, 16 Jul 2010 18:46:47 +0200

Changed in openjdk-6 (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.