Generate heapdump not showing up?

448 views
Skip to first unread message

David Karlsen

unread,
Sep 27, 2011, 10:48:21 AM9/27/11
to javamelody
Hi.

I'm on the latest javamelody release - and system actions are enabled with -Djavamelody.system-actions-enabled=true.
I have these options exposed:

Execute the garbage collector Execute the garbage collector     Invalidate http sessions Invalidate http sessions     View http sessions View http sessions
     View deployment descriptor View deployment descriptor     MBeans MBeans     View OS processes View OS processes     JNDI tree JNDI tree     Opened jdbc connections Opened jdbc connections     Database Database


but no generate heapdump?

I'm on Java 6 (IBM JDK).

--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Emeric Vernat

unread,
Sep 27, 2011, 4:22:28 PM9/27/11
to javam...@googlegroups.com
Hi,

Yes, the heap dump action is enabled in javamelody only if heap dump is considered enabled.
And heap dump is considered enabled by javamelody only if jdk is 1.6 or more and if vendor is just Sun or Oracle.
This is here:
http://code.google.com/p/javamelody/source/browse/trunk/javamelody-core/src/main/java/net/bull/javamelody/Action.java#87

In fact, I am not sure that heap dump can be done with an IBM JDK like this:
http://code.google.com/p/javamelody/source/browse/trunk/javamelody-core/src/main/java/net/bull/javamelody/Action.java#242
For example, can we take a heap dump using jvisualvm on an IBM JDK? (jvisualvm probably uses the same java class)

Anyway, if you want to test a heap dump using javamelody, I think that you can launch your server with the command line parameter "-Djava.vendor=Oracle".
The IBM JDK and javamelody should certainly think that it is an Oracle JDK and so you can try.
If it does not work with code like this, how to take a heap dump with an IBM JDK?

bye,
Emeric

David Karlsen

unread,
Sep 27, 2011, 4:41:23 PM9/27/11
to javam...@googlegroups.com
Doesn't seem like any MBeans are available for it, however:
"See Chapter 22, “Using dump agents,” on page 231 for more detailed information
about generating dumps based on specific events. Heapdumps can also be
generated programmatically by use of the com.ibm.jvm.Dump.HeapDump()
method from inside the application code.
"

From the document http://download.boulder.ibm.com/ibmdl/pub/software/dw/jdk/diagnosis/diag60.pdf linked from http://www.ibm.com/developerworks/java/jdk/diagnosis/ .

This could be called with reflection in case of vendor IBM.

2011/9/27 Emeric Vernat <eve...@free.fr>

David Karlsen

unread,
Oct 2, 2011, 4:21:55 AM10/2/11
to javam...@googlegroups.com

What dø you think about this approach?

>> [image: Execute the garbage collector] Execute the garbage collector<http://153.110.216.206:9091/pays/monitoring?action=gc>
>> [image: Invalidate http sessions] Invalidate http sessions<http://153.110.216.206:9091/pays/monitoring?action=invalidate_sessions>
>> [image: View http sessions] View http sessions<http://153.110.216.206:9091/pays/monitoring?part=sessions>
>> [image: View deployment descriptor] View deployment descriptor<http://153.110.216.206:9091/pays/monitoring?part=web.xml>
>> [image: MBeans] MBeans<http://153.110.216.206:9091/pays/monitoring?part=mbeans>
>> [image: View OS processes] View OS processes<http://153.110.216.206:9091/pays/monitoring?part=processes>
>> [image: JNDI tree] JNDI tree<http://153.110.216.206:9091/pays/monitoring?part=jndi>
>> [image: Opened jdbc connections] Opened jdbc connections<http://153.110.216.206:9091/pays/monitoring?part=connections>
>> [image: Database] Database<http://153.110.216.206:9091/pays/monitoring?part=database>

Emeric Vernat

unread,
Oct 2, 2011, 5:25:15 AM10/2/11
to javam...@googlegroups.com
If it works with an IBM jdk, I am ok with this using reflection in case of java.vendor IBM.

It seems that we do not specify a file for this method in IBM jdk and so the current code and message should be adapted.

Would you write a patch and test that?

bye,
Emeric


Le 02/10/2011 10:21, David Karlsen a �crit�:

What d� you think about this approach?

Den 27. sep. 2011 22:41 skrev "David Karlsen" <davidk...@gmail.com> f�lgende:
> Doesn't seem like any MBeans are available for it, however:
> "See Chapter 22, �Using dump agents,� on page 231 for more detailed
>> Le 27/09/2011 16:48, David Karlsen a �crit :

David Karlsen

unread,
Oct 2, 2011, 9:18:07 AM10/2/11
to javam...@googlegroups.com
Done: https://github.com/davidkarlsen/javamelody/commit/276bb21bfde96b92310d87566272f50fe3f94a76
Tested and works fine for me.
I can investigate more in the future to see if I'm able to get the path of the dump - but let's just settle with the current implementation for now?

2011/10/2 Emeric Vernat <eve...@free.fr>
If it works with an IBM jdk, I am ok with this using reflection in case of java.vendor IBM.

It seems that we do not specify a file for this method in IBM jdk and so the current code and message should be adapted.

Would you write a patch and test that?

bye,
Emeric


Le 02/10/2011 10:21, David Karlsen a écrit :

What dø you think about this approach?

Den 27. sep. 2011 22:41 skrev "David Karlsen" <davidk...@gmail.com> følgende:
> Doesn't seem like any MBeans are available for it, however:
> "See Chapter 22, “Using dump agents,” on page 231 for more detailed

David Karlsen

unread,
Oct 2, 2011, 9:59:08 AM10/2/11
to javam...@googlegroups.com
Here it is in patch format if you find that more convenient.

2011/10/2 David Karlsen <davidk...@gmail.com>
ibmheapdump.patch

Emeric Vernat

unread,
Oct 2, 2011, 11:45:19 AM10/2/11
to javam...@googlegroups.com
Hi,

I have slightly modified your patch and included it in trunk
http://code.google.com/p/javamelody/source/detail?r=2180

It is ready for the next release (1.32)
http://code.google.com/p/javamelody/wiki/ReleaseNotes

I have made a new build from the current trunk and it is available at:
http://javamelody.googlecode.com/files/javamelody-20111002.jar

Thanks for the patch,
Emeric

David Karlsen

unread,
Oct 2, 2011, 12:14:10 PM10/2/11
to javam...@googlegroups.com
Great - thanks!
When do you think you'll release?

2011/10/2 Emeric Vernat <eve...@free.fr>

Emeric Vernat

unread,
Oct 2, 2011, 1:01:46 PM10/2/11
to javam...@googlegroups.com
I think about a release in 2 weeks or 4 weeks max.

Emeric


Le 02/10/2011 18:14, David Karlsen a �crit�:
Great - thanks!
When do you think you'll release?

2011/10/2 Emeric Vernat <eve...@free.fr>
Hi,

I have slightly modified your patch and included it in trunk
http://code.google.com/p/javamelody/source/detail?r=2180

It is ready for the next release (1.32)
http://code.google.com/p/javamelody/wiki/ReleaseNotes

I have made a new build from the current trunk and it is available at:
http://javamelody.googlecode.com/files/javamelody-20111002.jar

Thanks for the patch,
Emeric


Le 02/10/2011 15:59, David Karlsen a �crit�:
Here it is in patch format if you find that more convenient.

2011/10/2 David Karlsen <davidk...@gmail.com>
Done: https://github.com/davidkarlsen/javamelody/commit/276bb21bfde96b92310d87566272f50fe3f94a76
Tested and works fine for me.
I can investigate more in the future to see if I'm able to get the path of the dump - but let's just settle with the current implementation for now?


2011/10/2 Emeric Vernat <eve...@free.fr>
If it works with an IBM jdk, I am ok with this using reflection in case of java.vendor IBM.

It seems that we do not specify a file for this method in IBM jdk and so the current code and message should be adapted.

Would you write a patch and test that?

bye,
Emeric


Le 02/10/2011 10:21, David Karlsen a �crit�:

What d� you think about this approach?

Den 27. sep. 2011 22:41 skrev "David Karlsen" <davidk...@gmail.com> f�lgende:
> Doesn't seem like any MBeans are available for it, however:
> "See Chapter 22, �Using dump agents,� on page 231 for more detailed
>> Le 27/09/2011 16:48, David Karlsen a �crit :
Reply all
Reply to author
Forward
0 new messages