websphere-7

Thread "WebContainer : 0" (00000029) has been active for 647279 milliseconds and may be hung


I am getting the following exception in WebSphere while trying to generate an excel report using jasper.

 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 0" (00000029) has been active for 647279 milliseconds and may be hung.  There is/are 1 thread(s) in total in the server that may be hung.

Tried increasing the default thread pool size from 20 to 50 and also increased WebContainer pool size from 50 to 150. Not worked.

Any solution for this.


Solution

  • Your error message tells that the thread named “ WebContainer : 0” has been doing something for 647 seconds or 10.7 minutes and 1 thread active in the JVM that my also hung (been active for longer than the threshold time).

    A hung thread is a thread in Java EE apps which is being blocked by a call or is waiting on a monitor for a locked object to be released, so that the thread can use it. A hung thread can result from a simple software defect (such as an infinite loop) or a more complex cause (for example, a resource deadlock). CPU utilization for that server's java process may become high and unresponsive if number of threads grows.

    There are ways to increase the hangtime (default 10min), but not recommended. You have optimize or limit your excel report generation process. I think, Report you are extracting is very big or hitting the db more for generation, basically might be due to code bug. Increasing the number of thread pool has nothing to do for your issue.

    In sysout.log: Below lines to the posted warning message, should give some idea about the Java EE class causing this issue. FFDC also helps this to figure it out.

    The hang detection option is turned on by default. You can configure it to accommodate the environment, so that potential hangs can be reported. When a hung thread is detected, WAS notifies you so that you can troubleshoot the problem.

    Using the hang detection policy, you can specify a time that is too long for a unit of work to complete. The thread monitor checks all managed threads including Web container threads.

    1. From the administrative console, click Servers > Application Servers > server_name
    2. Under Server Infrastructure, click Administration > Custom Properties & Click New.
    3. Add the following properties:

    Name: com.ibm.websphere.threadmonitor.interval
    Value: The frequency (in seconds) at which managed threads in the selected application server will be interrogated.
    Default: 180 seconds (three minutes).

    Name: com.ibm.websphere.threadmonitor.dump.java
    Value: Set to true to execute the dumpThreads function when a hung thread is detected and a WSVR0605W message is printed. The threads section of the javacore dump can be analyzed to determine what the reported thread
    Default: false (0).

    Name: com.ibm.websphere.threadmonitor.threshold
    Value: The length of time (in seconds) in which a thread can be active before it is considered hung. Any thread that is detected as active for longer than this length of time is reported as hung.
    Default: The default value is 600 seconds (ten minutes).

    Name: com.ibm.websphere.threadmonitor.false.alarm.threshold
    Value: The number of times (T) that false alarms can occur before automatically increasing the threshold. It is possible that a thread that is reported as hung eventually completes its work, resulting in a false alarm. A large number of these events indicates that the threshhold value is too small. The hang detection facility can automatically respond to this situation: For every T false alarms, the threshold T is increased by a factor of 1.5. Set the value to zero (or less) to disable the automatic adjustment. (Link to Detecting hung threads in J2EE applications for information on false alarms)
    Default: 100

    To disable the hang detection option, set the com.ibm.websphere.threadmonitor.interval property to less than or equal to zero.

    1. Save & Restart the WAS instance enter image description here