Use the thdumpSVC command to collect thread dumps of Java programs that are operated as a Windows service.
Use the following procedure to collect thread dumps:
Register a Windows service
Start the thread dump tool
Stop the thread dump tool
Delete the Windows service
You can collect multiple thread dumps by repeating steps 2 and 3.
When you have finished collecting thread dumps, perform step 4 "Delete the Windows service".
Use "InstallUtil.exe" of Windows (R) internally to register and delete a Windows service.
Use "sc.exe" to start and stop the thread dump tool.
Thread dump tool operations must be performed from the command prompt by a user with administrator privileges. To run the thread dump tool from the command prompt as an administrator, right-click the command prompt executable file in Explorer, and then select "Run as administrator".
To use the thdumpSVC command, you must install Microsoft(R) .NET FrameworkV2.0 in your operating environment.
Registering the thread dump tool as a Windows service
thdumpSVC -Install
To register the thread dump tool as a Windows service, set the thdumpSVC command storage destination directory as the current directory, or specify the full path of the thdumpSVC command, and execute the command shown above.
Please note that only one thread dump tool can be registered on the same system. If you attempt to register two or more thread dump tools, an error will occur on execution of the command.
You can use the Windows (R) administrative tool "Services" to check if the tool was successfully registered as a Windows service. If "Thdump Service" is displayed under "Name", this indicates that registration was successful.
If registration of the thread dump tool has already been completed, an error will occur, so use the Windows (R) administrative tool "Services" to check if the thread dump tool is registered.
Starting the thread dump tool
sc start thdumpService [-f logfile | -j] -p processed
or
sc start thdumpService [-f logfile | -j] program name with ".exe"
Refer to "F.1.3 Options" for information on each option.
To start the thread dump tool, execute the command shown above. After the command is executed, thread dumps are collected.
Please note that only one thread dump tool can be registered on the same system. An error will occur if the command shown above is executed while the thread dump tool is running.
You can use the Windows (R) administrative tool "Services" to check if the thread dump tool was started successfully. If the "Status" is "Started", this indicates that the tool was started successfully.
After executing the command, messages from sc command control are displayed in the window.
If an error occurs during the start, one of the strings shown below is displayed. Messages output when an error occurred should be checked, but messages output at other times can be ignored as they will not cause issues.
"[SC] StartService FAILED nnnn:" (nnnn is a number)
"[SC] StartService: OpenService FAILED nnnn:" (nnnn is a number)
If the thread dump tool has not been registered, or if the thread dump tool has already started, an error will occur, so use the Windows (R) administrative tool "Services" to check the status of the thread dump tool.
Below are examples of messages that are output when an error occurs:
If the thread dump tool has not been registered:
"[SC] StartService: OpenService FAILED 1060:"
If the thread dump tool has already started:
"[SC] StartService FAILED 1056:"
Stopping the thread dump tool
sc stop thdumpService
To stop the thread dump tool, execute the command shown above.
You can use the Windows (R) administrative tool "Services" to check if the thread dump tool was stopped successfully. If the "Status" is blank, this indicates that the thread dump tool was stopped successfully.
After executing the command, messages from sc command control are displayed in the window.
If an error occurs during the stop, one of the strings shown below is displayed. Messages output when an error occurred should be checked, but messages output at other times can be ignored as they will not cause issues.
"[SC] ControlService FAILED nnnn:" (nnnn is a number)
"[SC] OpenService FAILED nnnn:" (nnnn is a number)
If the thread dump tool has not been registered, or if the thread dump tool has already stopped, an error will occur, so use the Windows (R) administrative tool "Services" to check the status of the thread dump tool.
Below are examples of messages that are output when an error occurs:
If the thread dump tool has not been registered:
"[SC] OpenService FAILED 1060:"
If the thread dump tool has already stopped:
"[SC] ControlService FAILED 1062:"
Deleting the thread dump tool from Windows services
thdumpSVC -Install -u
To delete the thread dump tool from Windows services, set the thdumpSVC command storage destination directory as the current directory, or specify the full path of the thdumpSVC command, and execute the command shown above.
You can use the Windows (R) administrative tool "Services" to check if the tool was successfully deleted from Windows services. If "Thdump Service" is no longer displayed under "Name", this indicates that deletion was successful.
If deletion of the thread dump tool has already been completed (not registered), an error will occur, so use the Windows (R) administrative tool "Services" to check if the thread dump tool is registered.
Error log file
There is no console available for Windows services. Refer to the error log file to check if any errors occurred during collection of thread dumps.
Error log files are stored in the storage destination directory of the thdumpSVC command. Ensure that the storage destination directory of the thdumpSVC command is write-enabled.
Error log files are created during registration of Windows services, and are used to record errors that occur during the period up until deletion of Windows services. If thread dumps can be obtained without any issues, the error log file size will be 0 bytes.