How to find the cause for blocked threads found via jstack?
I ran jstack on my java application (runs on tomcat and ubuntu server edition) because it seems to consume a lot of memory after a while.
So, with jstack I found out that many threads seem to be blocked:
Con开发者_高级运维sole log: http://dl.dropbox.com/u/17844821/zeug/threaddumpexception.txt
Threaddump: http://dl.dropbox.com/u/17844821/zeug/threaddump.txt
So, I know that threads are blocked but how can I find out which java class causes this and even more important: How can I force these threads to terminate?
Any help would be greatly appreciated.
It came out that the threaddump produced by jstack was not correct.
I had to do two things to get the correct dump:
- Replaced OpenJDK with sun's original sun-6-jdk and sun-6-jre packages
- I modified the jstack call to use 64-bit mode and run it as tomcat-user like this:
sudo -u tomcat6 jstack -J-d64 -m pid
That gave me a threaddump which looks correct now (no blocked threads).
I think that these threads are waiting for some normal IO (sockets, loggers, and others).
Normally, when a thread came blocked, jstack shows full stack until block call.
You can analyses the stack and check the call trace and decide if this thread was blocked from some bug/problem or it's normal execution of the server or application.
[]'s,
And Past
精彩评论