How to take a thread dump on CA APM WebView process when it is running as a Windows service

Document ID : KB000100990
Last Modified Date : 13/06/2018
Show Technical Document Details
Introduction:
When WebView is running as a service the java process is running as the system account and this can prevent using a normal Java utility like jstack to trigger a thread dump to be written because of permissions problems e.g.
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
Environment:
APM WebView 9.x, 10.x
Instructions:
In order to trigger a thread dump it is necessary to use the same wrapper program that is running the service.
Configure the wrapper to define the signal that will trigger the thread dump by editing the WVService.conf file in the folder <EM_HOME>/bin or <WEBVIEW_HOME/bin if WebView is installed on a separate server to the EM/MOM.
Add the following line:
wrapper.thread_dump_control_code=255
Restart the WebView service.

To generate a thread dump use the appropriate wrapper executable which is located in the <EM_HOME>/bin folder e.g. for 10.7 WebView which uses a 64-bit JVM start a command prompt, cd to <EM_HOME>/bin folder and run command:
C:\Program Files\CA APM\Introscope10.7.0.45\bin>ServiceWrapper64.exe -l=255 .\WVService.conf

The thread dump will now be written to the WVService.log file (not the IntroscopeWebView.log) e.g.
STATUS | wrapperm | 2018/06/13 06:42:33 | Sent the Introscope WebView 10.7 service control code 255.
STATUS | wrapper  | 2018/06/13 06:42:33 | Dumping JVM state.
INFO   | jvm 1    | 2018/06/13 06:42:33 | 2018-06-13 06:42:33
INFO   | jvm 1    | 2018/06/13 06:42:33 | Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.112-b15 mixed mode):
INFO   | jvm 1    | 2018/06/13 06:42:33 | 
INFO   | jvm 1    | 2018/06/13 06:42:33 | "Timer-2" #51 daemon prio=5 os_prio=0 tid=0x000000001a7bc800 nid=0x1fe4 in Object.wait() [0x000000001febf000]
INFO   | jvm 1    | 2018/06/13 06:42:33 |    java.lang.Thread.State: TIMED_WAITING (on object monitor)
INFO   | jvm 1    | 2018/06/13 06:42:33 |     at java.lang.Object.wait(Native Method)
INFO   | jvm 1    | 2018/06/13 06:42:33 |     at java.util.TimerThread.mainLoop(Timer.java:552)
INFO   | jvm 1    | 2018/06/13 06:42:33 |     - locked <0x00000000cf8f93b0> (a java.util.TaskQueue)
INFO   | jvm 1    | 2018/06/13 06:42:33 |     at java.util.TimerThread.run(Timer.java:505)