[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: Unable to create hprof heap dump from core file with jmap on Oracle Solaris
From:       Basil Crow <me () basilcrow ! com>
Date:       2015-08-06 15:46:28
Message-ID: CAFwNDjoGtafnkx5nx2iz_Vkk+BgbzWhyOQPsNqR-5BZY_WwXNw () mail ! gmail ! com
[Download RAW message or body]

On Sun, Apr 5, 2015 at 1:01 AM, Dmitry Samersoff
<dmitry.samersoff@oracle.com> wrote:
> Basil,
>
> jmap uses SA backend to extract data from coredump and it doesn't
> support lambda.
>
> See JDK-8073604
>
> -Dmitry

Hi Dmitry,

While I'm pleased to see that JDK-8044416 (of which JDK-8073604 is a
duplicate) was integrated and backported to 8u60, I'm sad to report that I am
still unable to meaningfully work with hprof heap dumps generated from core
files when lambdas are in use.

Here is a minimal test case running on Oracle Solaris:

$ uname -a
SunOS solaris 5.11 11.2 i86pc i386 i86pc
$ java -version
java version "1.8.0_60-ea"
Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
$ cat LambdaSleep.java
import java.util.Arrays;

public class LambdaSleep {
    public static void main(String[] args) throws InterruptedException {
String[] words = new String[] { "longer", "short" };
Arrays.sort(words, (first, second) ->
Integer.compare(first.length(), second.length()));
Thread.sleep(300000);
    }
}
$ javac LambdaSleep.java
$ java LambdaSleep &
[1] 4528

I took two hprof heap dumps of this program. The first, live4528.hprof, comes
from the live process:

$ jmap -dump:format=b,file=live4528.hprof 4528
Dumping heap to /export/home/basil/live4528.hprof ...
Heap dump file created

The second, core4528.hprof, comes from a core dump:

$ gcore 4528
gcore: core.4528 dumped
$ jmap -dump:format=b,file=core4528.hprof /opt/jdk/bin/java core.4528
Attaching to core core.4528 from executable /opt/jdk/bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.60-b23
Dumping heap to core4528.hprof ...
Heap dump file created

With the fix for JDK-8044416 in place, the heap dump is generated without any
exceptions (which is an improvement), but it is still not usable in any
meaningful way.

While live4528.hprof loads in Eclipse MAT, core4528.hprof fails to load in
Eclipse MAT with the following exception:

!ENTRY org.eclipse.core.jobs 4 2 2015-08-06 08:32:45.883
!MESSAGE An internal error occurred during: "Parsing heap dump from
'core4528.hprof'".
!STACK 0
java.lang.NullPointerException
at org.eclipse.mat.hprof.HprofParserHandlerImpl.resolveClassHierarchy(HprofParserHandlerImpl.java:587)
at org.eclipse.mat.hprof.Pass2Parser.readInstanceDump(Pass2Parser.java:205)
at org.eclipse.mat.hprof.Pass2Parser.readDumpSegments(Pass2Parser.java:159)
at org.eclipse.mat.hprof.Pass2Parser.read(Pass2Parser.java:89)
at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:94)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:222)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:126)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:145)
at org.eclipse.mat.ui.snapshot.ParseHeapDumpJob.run(ParseHeapDumpJob.java:83)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

While both live4528.hprof and core4528.hprof load in VisualVM, attempting to
find objects by retained size in VisualVM hangs on "Computing retained
sizes..." for core4528.hprof, while this operation succeeds for
live4528.hprof.

When lambdas are not in use, the above problem is not manifest. Clearly there
is a difference in the hprof heap dump generated from the core file compared
to the one generated from the live process.

An update would be appreciated, as this bug greatly hampers our ability to
debug memory leaks in production.

Thanks,
Basil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic