ADDITIONAL SYSTEM INFORMATION :
OS
centos-release-7-6.1810.2.el7.centos.x86_64
and
centos-release-6-10.el6.centos.12.3.x86_64
JDK
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment 18.9 (build 11.0.5+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10, mixed mode)
A DESCRIPTION OF THE PROBLEM :
I can no longer use jhsdb jmap to generate a heap dump from a core dump created by gdb. The issue only occurs if prelink is enabled. Only OpenJDK 11.0.5 is affected. OpenJDK 11.0.4 and Orcale JDK 11.0.5 are not affected.
REGRESSION : Last worked in version 11
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use CentOS 7 or 6. (I tested with centos-release-7-6.1810.2.el7.centos.x86_64 and centos-release-6-10.el6.centos.12.3.x86_64).
2. Install OpenJDK 11.0.5 (I used https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.5%2B10/OpenJDK11U-jdk_x64_linux_11.0.5_10.tar.gz).
3. Install prelink (yum install prelink).
4. Enable it (prelink -a).
5. Start any Java process. I used the default Tomcat 9 installation for example.
6. Create a core dump using gdb. I used the following commands:
gdb
attach <Java PID>
gcore jvm-prelink.core
detach
quit
7. Use jhsdb jmap to convert it to a Java heap dump:
jhsdb jmap --binaryheap --dumpfile dump.hprof --exe <path to java>/java --core jvm-prelink.core
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
dump.hprof is created
ACTUAL -
I'm getting an error. It looks like this with LIBSAPROC_DEBUG set to true:
libsaproc DEBUG: lib_ld = 0x3001614c38, lib_dyn_addr = 0x3001614c38 -> lib_base_diff = 0x0
Error attaching to core file: Can't attach to the core file
sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the core file
at jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
at jdk.hotspot.agent/sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:282)
at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:674)
at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:612)
at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:338)
at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:157)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.main(JMap.java:176)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:329)
at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:488)
CUSTOMER SUBMITTED WORKAROUND :
Use OpenJDK 11.0.4 or Orcale JDK 11.0.5 instead of OpenJDK 11.0.5.
FREQUENCY : always