You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by DERIES Sebastien <se...@thalesgroup.com> on 2015/02/05 10:36:57 UTC

karaf, heap dumps, jvisualvm

Hi guys,
I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in one of our bundles we developed. I created a heap dump using the karaf command dump-create which is very useful. It created a dump.zip file containing all the information I need. However, I tried to open the heapdump.txt with jvisualvm to analyze the memory of our application but jvisualvm cannot open the dump file. I used a second memory analysis tool, eclipse memory analyzer and this tool was able to open the dump file and get the information of the dump ... Have you ever tried opening a memory dump with visualvm, it is the tool I prefer for finding leaks?

Secondly, I like to " live" monitor memory using jvisualvm  and use its Heap Dump button to create memory dumps when I want to, but when I try to use this command it doesn't work and I get the error "cannot take heap dump for org.apache.main.Main" ? Is there a way to configure karaf so that I can dump memory through jvisualvm ?

Which tool do you usually use to find memory leaks  ?

Thank you.

Regards

Seb



[@@ OPEN @@]


Re: karaf, heap dumps, jvisualvm

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
As it works for me, I suspect something about the permission.

Do you have permission to writing in the /users directory ? Maybe Karaf 
has been launched by another user and you can't access to the process ?

Regards
JB

On 02/05/2015 10:56 AM, DERIES Sebastien wrote:
> Hi JB,
> Thank you for the great job you do and for your quick answer.
>
> I have already tried jmap but I got an exception:
>
> ./jdk1.8.0_40/bin/jmap -F -dump:file=/users/file.hprof 853
>
> Attaching to process ID 853, please wait...
> Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
> sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163)
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278)
>          at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
>          at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
>          at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
>          at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
>          at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
>          at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
>          at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
>          at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:497)
>          at sun.tools.jmap.JMap.runTool(JMap.java:201)
>          at sun.tools.jmap.JMap.main(JMap.java:130)
> Caused by: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$100(LinuxDebuggerLocal.java:62)
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1AttachTask.doit(LinuxDebuggerLocal.java:269)
>          at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:138)
>
>
> However I can connect to jconsole or jvisualvm.
>
> [@@ THALES GROUP INTERNAL @@]
>
> -----Message d'origine-----
> De : Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
> Envoyé : jeudi 5 février 2015 10:42
> À : user@karaf.apache.org
> Objet : Re: karaf, heap dumps, jvisualvm
>
> Hi Sébastien,
>
> did you simply try a jmap (with the Karaf PID) ?
>
> I use jvisualvm (or jhat) for analyses.
>
> Regards
> JB
>
> On 02/05/2015 10:36 AM, DERIES Sebastien wrote:
>> Hi guys,
>>
>> I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in
>> one of our bundles we developed. I created a heap dump using the karaf
>> command dump-create which is very useful. It created a dump.zip file
>> containing all the information I need. However, I tried to open the
>> heapdump.txt with jvisualvm to analyze the memory of our application
>> but jvisualvm cannot open the dump file. I used a second memory
>> analysis tool, eclipse memory analyzer and this tool was able to open
>> the dump file and get the information of the dump . Have you ever
>> tried opening a memory dump with visualvm, it is the tool I prefer for finding leaks?
>>
>> Secondly, I like to " live" monitor memory using jvisualvm  and use
>> its Heap Dump button to create memory dumps when I want to, but when I
>> try to use this command it doesn't work and I get the error "cannot
>> take heap dump for org.apache.main.Main" ? Is there a way to configure
>> karaf so that I can dump memory through jvisualvm ?
>>
>> Which tool do you usually use to find memory leaks  ?
>>
>> Thank you.
>>
>> Regards
>>
>> Seb
>>
>> [@@ OPEN @@]
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

RE: karaf, heap dumps, jvisualvm

Posted by DERIES Sebastien <se...@thalesgroup.com>.
Hi JB,
Thank you for the great job you do and for your quick answer.

I have already tried jmap but I got an exception:

./jdk1.8.0_40/bin/jmap -F -dump:file=/users/file.hprof 853

Attaching to process ID 853, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278)
        at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
        at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
        at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.tools.jmap.JMap.runTool(JMap.java:201)
        at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$100(LinuxDebuggerLocal.java:62)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1AttachTask.doit(LinuxDebuggerLocal.java:269)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:138)


However I can connect to jconsole or jvisualvm.

[@@ THALES GROUP INTERNAL @@]

-----Message d'origine-----
De : Jean-Baptiste Onofré [mailto:jb@nanthrax.net] 
Envoyé : jeudi 5 février 2015 10:42
À : user@karaf.apache.org
Objet : Re: karaf, heap dumps, jvisualvm

Hi Sébastien,

did you simply try a jmap (with the Karaf PID) ?

I use jvisualvm (or jhat) for analyses.

Regards
JB

On 02/05/2015 10:36 AM, DERIES Sebastien wrote:
> Hi guys,
>
> I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in 
> one of our bundles we developed. I created a heap dump using the karaf 
> command dump-create which is very useful. It created a dump.zip file 
> containing all the information I need. However, I tried to open the 
> heapdump.txt with jvisualvm to analyze the memory of our application 
> but jvisualvm cannot open the dump file. I used a second memory 
> analysis tool, eclipse memory analyzer and this tool was able to open 
> the dump file and get the information of the dump . Have you ever 
> tried opening a memory dump with visualvm, it is the tool I prefer for finding leaks?
>
> Secondly, I like to " live" monitor memory using jvisualvm  and use 
> its Heap Dump button to create memory dumps when I want to, but when I 
> try to use this command it doesn't work and I get the error "cannot 
> take heap dump for org.apache.main.Main" ? Is there a way to configure 
> karaf so that I can dump memory through jvisualvm ?
>
> Which tool do you usually use to find memory leaks  ?
>
> Thank you.
>
> Regards
>
> Seb
>
> [@@ OPEN @@]
>

--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: karaf, heap dumps, jvisualvm

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Sébastien,

did you simply try a jmap (with the Karaf PID) ?

I use jvisualvm (or jhat) for analyses.

Regards
JB

On 02/05/2015 10:36 AM, DERIES Sebastien wrote:
> Hi guys,
>
> I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in
> one of our bundles we developed. I created a heap dump using the karaf
> command dump-create which is very useful. It created a dump.zip file
> containing all the information I need. However, I tried to open the
> heapdump.txt with jvisualvm to analyze the memory of our application but
> jvisualvm cannot open the dump file. I used a second memory analysis
> tool, eclipse memory analyzer and this tool was able to open the dump
> file and get the information of the dump … Have you ever tried opening a
> memory dump with visualvm, it is the tool I prefer for finding leaks?
>
> Secondly, I like to “ live” monitor memory using jvisualvm  and use its
> Heap Dump button to create memory dumps when I want to, but when I try
> to use this command it doesn’t work and I get the error “cannot take
> heap dump for org.apache.main.Main” ? Is there a way to configure karaf
> so that I can dump memory through jvisualvm ?
>
> Which tool do you usually use to find memory leaks  ?
>
> Thank you.
>
> Regards
>
> Seb
>
> [@@ OPEN @@]
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: karaf, heap dumps, jvisualvm

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I tried the same with Java 8 (Oracle JDK 1.8.0_20) without problem.

Regards
JB

On 02/05/2015 10:48 AM, Jean-Baptiste Onofré wrote:
> By the way, I just tried Karaf 3.0.2 with Java7:
>
> 1/ I used dev:dump-create
> 2/ after uncompress the dump zipfile, I have the heapdump.txt
> 3/ in jvisualvm, I used "File->Load" with "Heap Dumps (*.hprof,*.*)",
> and selected the heapdump.txt
> 4/ the heapdump opens without problem in jvisualvm
>
> I'm trying with Java8.
>
> Regards
> JB
>
> On 02/05/2015 10:36 AM, DERIES Sebastien wrote:
>> Hi guys,
>>
>> I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in
>> one of our bundles we developed. I created a heap dump using the karaf
>> command dump-create which is very useful. It created a dump.zip file
>> containing all the information I need. However, I tried to open the
>> heapdump.txt with jvisualvm to analyze the memory of our application but
>> jvisualvm cannot open the dump file. I used a second memory analysis
>> tool, eclipse memory analyzer and this tool was able to open the dump
>> file and get the information of the dump … Have you ever tried opening a
>> memory dump with visualvm, it is the tool I prefer for finding leaks?
>>
>> Secondly, I like to “ live” monitor memory using jvisualvm  and use its
>> Heap Dump button to create memory dumps when I want to, but when I try
>> to use this command it doesn’t work and I get the error “cannot take
>> heap dump for org.apache.main.Main” ? Is there a way to configure karaf
>> so that I can dump memory through jvisualvm ?
>>
>> Which tool do you usually use to find memory leaks  ?
>>
>> Thank you.
>>
>> Regards
>>
>> Seb
>>
>> [@@ OPEN @@]
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: karaf, heap dumps, jvisualvm

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
By the way, I just tried Karaf 3.0.2 with Java7:

1/ I used dev:dump-create
2/ after uncompress the dump zipfile, I have the heapdump.txt
3/ in jvisualvm, I used "File->Load" with "Heap Dumps (*.hprof,*.*)", 
and selected the heapdump.txt
4/ the heapdump opens without problem in jvisualvm

I'm trying with Java8.

Regards
JB

On 02/05/2015 10:36 AM, DERIES Sebastien wrote:
> Hi guys,
>
> I use Karaf 3.0.2 with java 8_u40 and investigate on a memory leak in
> one of our bundles we developed. I created a heap dump using the karaf
> command dump-create which is very useful. It created a dump.zip file
> containing all the information I need. However, I tried to open the
> heapdump.txt with jvisualvm to analyze the memory of our application but
> jvisualvm cannot open the dump file. I used a second memory analysis
> tool, eclipse memory analyzer and this tool was able to open the dump
> file and get the information of the dump … Have you ever tried opening a
> memory dump with visualvm, it is the tool I prefer for finding leaks?
>
> Secondly, I like to “ live” monitor memory using jvisualvm  and use its
> Heap Dump button to create memory dumps when I want to, but when I try
> to use this command it doesn’t work and I get the error “cannot take
> heap dump for org.apache.main.Main” ? Is there a way to configure karaf
> so that I can dump memory through jvisualvm ?
>
> Which tool do you usually use to find memory leaks  ?
>
> Thank you.
>
> Regards
>
> Seb
>
> [@@ OPEN @@]
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com