开发者

How to find the cause for blocked threads found via jstack?

开发者 https://www.devze.com 2023-04-08 17:38 出处:网络
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.

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:

  1. Replaced OpenJDK with sun's original sun-6-jdk and sun-6-jre packages
  2. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消