Dumping threads in server processes using scripting
Use the AdminControl object to produce a Java core dump, which includes the Java threads of a running server.
See the Start the wsadmin scripting client article for more information.
(ZOS) The dumpThreads command generates a Java heap dump, a JVM initiated System Transaction Dump (TDUMP), and a Java core dump.
- A Java heap dump includes all of the live objects on the Java heap that are being used by the running Java application.
- A system TDUMP includes the content of all of the failing address spaces.
In some circumstances, the hung thread detection process might be frequently triggered, causing system TDUMPs to be initiated. These dumps can be large and take several minutes to process. While the dumps are being processed, the server address space is not dispatchable, which might extend the length of time locks owned by the address space are held. If the server uses shared sub-systems like DB2 or IBM MQ, the extended length of time during which the locks might be held could adversely effect those shared sub-systems, and other address spaces that share those sub-systems. Therefore, if we experience frequent hung threads, we might want to disable the taking of system TDUMPs on the application server experiencing the hung threads.
- A Java core dump includes all of the memory being used used by the JVM, and includes the state of every thread in the server processes.
(ZOS) To disable the generation of the heap dump, set the wsadmin_dumpthreads_enable_heapdump environment variable to 0. To disable the generation of the system TDUMP, set the wsadmin_dumpthreads_enable_javatdump environment variable to 0. We can set these variables at either the node or cell level.
Tasks
Issue one of the following commands to produce a Java core dump.
- Jacl:
set jvm [$AdminControl completeObjectName type=JVM,process=server1,*] $AdminControl invoke $jvm dumpThreads- Jython:
jvm = AdminControl.completeObjectName('type=JVM,process=server1,*') AdminControl.invoke(jvm, 'dumpThreads')(ZOS) We can also use the Modify command to generate a Java core dump whenever a timeout occurs.
(ZOS) For information about the environment variables that deal with dumping threads, refer to the Java Diagnostics guide.
The dumpThreads command creates other types of dump files depending on the -Xdumps settings. Dump output varies depending on the platform and might include system core files, heap, and snap dumps.
wsadmin AdminControl Commands for the AdminControl object (ZOS) Modify command (ZOS) Application server custom properties for z/OS