How to take a thread dump in the Enterprise manager when it is running as a Windows service

Document ID : KB000019088
Last Modified Date : 27/02/2018
Show Technical Document Details
Introduction:

Because the java process is running as the system account when the Enterprise Manager is a service, it is not possible to use the normal utility i.e. jstack to trigger a thread dump to be written. It will encounter permissions problems.

C:\Program Files\Java\jdk<version>\bin>jstack -l 2436
2436: Insufficient memory or insufficient privileges to attach
The -F option can be used when the target process is not responding

 

Instructions:

Solution:

In order to trigger a thread dump it is necessary to use the same wrapper program that is running the service.

First, configure the wrapper to define the signal that will trigger the thread dump.

Edit the EMService.conf file in the <EM_HOME>/bin folder and add the following line:

  • wrapper.thread_dump_control_code=255

Restart the EM service.

To generate a thread dump, use the appropriate wrapper executable which is located in the <EM_HOME>/bin folder e.g. for a 64 bit JVM

C:\Program Files\CA APM\Introscope10.5.1.0\bin>servicewrapper64 -l=255 .\EMService.conf

The output will look like the following and the thread dump will now be written to the EMService.log file (not the IntroscopeEnterpriseManager.log):

wrapper | Sent the Introscope Enterprise Manager service control code 255.

STATUS | wrapper  | 2018/02/07 16:37:24 | Sent the Introscope Enterprise Manager service control code 255.
STATUS | wrapper  | 2018/02/07 16:37:24 | Dumping JVM state.
INFO   | jvm 1    | 2018/02/07 16:37:24 | 2014-02-07 16:37:24
INFO   | jvm 1    | 2018/02/07 16:37:24 | Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode):
INFO   | jvm 1    | 2018/02/07 16:37:24 | 
INFO   | jvm 1    | 2018/02/07 16:37:24 | "btpool0-18" prio=6 tid=0x0000000013426800 nid=0x11fc in Object.wait() [0x000000001c5bf000]
INFO   | jvm 1    | 2018/02/07 16:37:24 |    java.lang.Thread.State: TIMED_WAITING (on object monitor)
INFO   | jvm 1    | 2018/02/07 16:37:24 | at java.lang.Object.wait(Native Method)
INFO   | jvm 1    | 2018/02/07 16:37:24 | at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:491)
INFO   | jvm 1    | 2018/02/07 16:37:24 | - locked <0x0000000694d788e0> (a org.mortbay.thread.BoundedThreadPool$PoolThread)