Tuesday, 22 October 2013

WebSphere Application Server JVMs - Dumping

Thanks to my mate, Mike, for this.

<caveat emptor>

Want to force a WAS JVM ( or, almost certainly, any other JVM ) to generate a core dump ( Javacore ) ?

Using Unix ?

If so, identify the Process ID ( PID ) of the JVM, perhaps using ps auxw | grep -i java and then, once you've checked AND double-checked that it's the right PID, issue this command: -

$ kill -3 12345

( where 12345 is an example of the PID )

The Javacore will be, by default, written to the WAS profile root e.g. /opt/IBM/WebSphere/AppServer/profiles/AppSrv01.

Want to force a heap dump ?

If so, fire up wsadmin: -

$ cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
$ ./wsadmin.sh -lang jacl

wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<JVM Name>,node=<Node Name>,*] 

which returns something like this: -
 
WebSphere:name=JVM,process=bpmPCapp01-server01,platform=proxy,node=primary_base,j2eeType=JVM,J2EEServer=base-bpmPCapp01-server01,version=7.0.0.25,type=JVM,mbeanIdentifier=JVM,cell=ProcCtr03Cell,spec=1.0

wsadmin> $AdminControl invoke $objectName generateHeapDump

Again, the heap dump  will be, by default, written to the WAS profile root e.g. /opt/IBM/WebSphere/AppServer/profiles/AppSrv01

</caveat emptor>

Remember - your mileage may vary - if in doubt, do nowt

3 comments:

Unknown said...

there's a good practice here to explicitly define the directory that dumps are written to. Mainly because that will allow you tostop them filling up the whole filesystem, and killing everything instead of just one jvm.

you can specify the javacore via IBM_JAVACOREDIR in the jvm props.
theere's also an equivalent for heap and native core dumps see
https://www-304.ibm.com/support/docview.wss?uid=swg21427620

Unknown said...

or http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/topic/com.ibm.java.doc.diagnostics.50/diag/appendixes/env_var/env_jvm.html

if you don't want to change the scripts

Dave Hay said...

Cheers, Mike, much obliged :-)

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...