开发者

Bizzare thread blocks creating primitive arrays

开发者 https://www.devze.com 2023-02-20 02:43 出处:网络
We recently had a situation where a production machine went down with a massive thread dump. It\'s resin webserver, and it gave \'Full thread dump Java HotSpot(开发者_运维问答TM) 64-Bit Server VM (14.

We recently had a situation where a production machine went down with a massive thread dump. It's resin webserver, and it gave 'Full thread dump Java HotSpot(开发者_运维问答TM) 64-Bit Server VM (14.0-b16 mixed mode):'.

There are a ton of BLOCKED threads, but they are confusing to me. IE, one is like:

"resin-8576" daemon prio=10 tid=0x00007f871827b800 nid=0x6b5 waiting for monitor entry [0x00007f864a7e6000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.lang.String.toCharArray(String.java:2725)
        at java.lang.Thread.setName(Thread.java:1051)
        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:605)
        at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:730)
        at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:649)
        at java.lang.Thread.run(Thread.java:619)

The code there is

char result[] = new char[count];

Another one is like

"resin-8574" daemon prio=10 tid=0x00007f8718277800 nid=0x6b3 waiting for monitor entry [0x00007f864a9e8000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.lang.String.valueOf(String.java:2840)
        at java.lang.Thread.getName(Thread.java:1061)
        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
        at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:730)
        at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:649)
        at java.lang.Thread.run(Thread.java:619)

Where the code of String there is

return new String(data);

Those seem like strange places to be blocked.

Could anyone suggest a reason those calls would be blocking?

Thanks, -kal


It sounds like this method could be called alot and generate a lot of garbage. When the GC runs these methods whcih allocate objects could appear to be block while waiting for the GC.

I would try a more up to date JVM. e.g. Java 6 update 24 (which has JVM build 19 or 20) as you appear to have an older JVM.

0

精彩评论

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

关注公众号