问题
I am facing an issue that WAS threads are getting hung.
Configurations:
OS: AIX,
WAS: 6.1.0.31
com.ibm.websphere.threadmonitor.interval: 180 seconds
com.ibm.websphere.threadmonitor.threshold: 10 minutes
com.ibm.websphere.threadmonitor.false.alarm.threshold: 100
Above settings are for hung detection.
Is there any way that I can clean up the hung threads ?
Thanks in advance.
回答1:
No. WAS doesn't provide mechanism for that. What you see is a watchdog mechanism that provides merely notifications. You are supposed to actually fix the underlying problem why the threads get hung in the first place. To get started with that issue
kill -3 <pid>
and read the stack traces. It is likely that after a few you will start seeing a pattern and then you have to read the source code for your applications to understand what really went wrong and how to fix it.
回答2:
As far as I know it is Java that does not allow to kill a thread which is hung. The best thing is to avoid hanging threads by hunting down the cause. Like already mentioned in the other answer, try to force the application server to create a thread dump (aka Java Core) and analyze its content. On Linux/UNIX systems a
kill -3 <pid>
will do the job. You'll find free graphical tools in the internet to look into these dumps. I typically use one which is called IBM Thread and Monitor Dump Analyzer for Java. The WebSphere Application Server log file will tell you the thread name to look for.
回答3:
You have tool to interpret. I have not used it in production though (never had that requirement, we go for a clean restart). You can check this out though. It uses bytecode instrumentation.
http://www.ibm.com/developerworks/websphere/downloads/hungthread.html
来源:https://stackoverflow.com/questions/6843157/was-threads-are-getting-hung