Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to choose whether to generate heap dump or not on the fly?

We have an application which is deployed to a WebSphere server running on UNIX, and we are experiencing two issues:

  1. a system hang which recovers after a few minutes - to investigate, we will need the thread dump (javacore).
  2. a system hang which does not recover and requires WebSphere to be restarted - to investigate, we will need the thread dump and heap dump.

The problem is: when a system hang occurs, we do not know whether it is issue 1 or 2.

Ideally we would like to manually generate the thread dump first, and wait to see if the system recovers. If it does not, then we generate the thread dump and the heap dump, before restarting WebSphere.

I know about the kill -3 (or kill -QUIT) command. The command would generate thread dump only (if the parameter IBM_HEAPDUMP=false), or thread dump and heap dump (if IBM_HEAPDUMP=true). However, IBM_HEAPDUMP has to be set before WebSphere is started and cannot be changed while WebSphere is running.

Is my understanding correct, regarding the IBM_HEAPDUMP parameter and the kill -3 command?

Also, is it possible get the logs in the way I described? (i.e. when generating JVM diagnostics, choose whether to generate heap dump or not on the fly)

like image 318
Andy Avatar asked Nov 03 '22 23:11

Andy


1 Answers

Your understanding is consistent with everything I've read.

However, I believe you can accomplish what you want by using wsadmin scripting. This article describes how to force javacores and heapdumps on a Windows platform where kill -3 is not available, but the same commands can be run on any WebSphere system.

From within wsadmin or a wsadmin script, execute:

set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]​
$AdminControl invoke $jvm generateHeapDump​
$AdminControl invoke $jvm dumpThreads​
like image 156
dbreaux Avatar answered Nov 09 '22 13:11

dbreaux