You may want to first read up on what is a process and what is a thread.
Create thread monitor custom properties
In the WebSphere admin console, at Servers > Server Types > WebSphere application servers > your application server > Administration > Custom properties > New, you can create the following key:value pairs to write hung thread events to the HPEL or SystemOut.log. These are the custom properties that check if a thread created by an application is hung. This will append event WSVR0605W to the HPEL or SystemOut.log when the thread monitor threshold has been exceeded. You will need to restart the application server for this change to take effect. In this example, a thread will be consider hung when the thread has been active for 1 minute or longer.
name | value | description |
---|---|---|
com.ibm.websphere.threadmonitor.interval | integer | Number of seconds between each interval to see if there are any hung threads, such as 30 (seconds). |
com.ibm.websphere.threadmonitor.threshold | integer | Number of seconds that must elapse before a thread is considered hung, such as 60 (1 minute). |
Similarly, the following custom properties can be created to append events to the HPEL or SystemOut.log when a system alarm thread is hung.
name | value | description |
---|---|---|
com.ibm.websphere.alarmthreadmonitor.checkinterval.millis | integer | Number of miliseconds between each interval to see if there are any system alarm hung threads, such as 10000 (10 seconds). |
com.ibm.websphere.alarmthreadmonitor.threshold.millis | integer | Number of miliseconds that must elapse before a system alarm thread is considered hung, such as 10000 (10 seconds). |
Automatically increase threshold (false alarm)
Let's say a thread created by an application tends to take 30 seconds to complete, and it has been determined that 30 seconds is acceptable. Let's salso say that both com.ibm.websphere.threadmonitor.threadhold and com.ibm.websphere.threadmonitor.interval are set to 10 seconds. This is going to cause a WSVR0605W (hung thread detected) and WSVR0606W (hung thread completed) to be appended to the HPEL or SystemOut.log every time the thread exceeds 10 seconds. If the application is constantly creating the 30 second thread, the HPEL or SystemOut.log will have a large number of WSVR0605W and WSVR0606W. The following key:value can be created to detect this type of scenario.
This will automatically increase the com.ibm.websphere.threadmonitor.threadhold value, by a factor of 1.5. If the threadhold is 10 seconds, and this evaluates to true, then the threshold would be updated to 15 seconds.
name | value | description |
---|---|---|
com.ibm.websphere.threadmonitor.false.alarm.threadhold | integer | Number of times (such as 100) that a false alarm occurs before automatically increasing threshold |
End a hung thread after x milliseconds
At Servers > Server types > your application server > Thread pools > Web container, by default, thread inactivity timeout will be set to 5000 milliseconds (that's 5 seconds). This means that any Web container thread that has been active for 5000 milliseconds will be ended, thus preventing the thread from become a hung thread, if the minimum size has been reached. Threads will not be destroyed if the number of threads is below the minimum.
Thread Dump
Create the following custom property to create a javacore dump when a thread created by an application has been active longer than the com.ibm.websphere.threadmonitor.threadhold value.
Name | Value | Description |
---|---|---|
com.ibm.websphere.threadmonitor.dump.java | 1 | Create a javacore dump when a hung thread is detected. |
Create the following custom property to create a javacore dump when a thread has been active longer than the com.ibm.websphere.alarmthreadmonitor.threadhold.millis value.
Name | Value | Description |
---|---|---|
com.ibm.websphere.alarmthreadmonitor.generate.javacore | 1 | Create a javacore dump when a hung thread is detected. |
Replicate hung thread
If you want to create a servlet in Eclipse that will produce a hung thread, refer to this article.
Analyze a thread dump
IBMs Thread and Monitor Dump Analyzer tool can also be used to analyze a thread dump.
Did you find this article helpful?
If so, consider buying me a coffee over at