How To Find Safe Point Timeout Thread

How To Find Safe Point Timeout Thread

這篇介紹How To Find Safe Point Timeout Thread。

JVM參數

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-XX:+SafepointTimeout

-XX:SafepointTimeoutDelay=2000

以上兩個參數表示當有Thread進入Safe Point超過2000ms時,會認為發生Timeout。
在catalina.out會印出哪個Thread沒有進入Safe Point。

Print example:
# SafepointSynchronize::begin: Timeout detected:
# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint.
# SafepointSynchronize::begin: Threads which did not reach the safepoint:
# "redisson-netty-2-51" #75 prio=5 os_prio=0 tid=0x00007fa264001000 nid=0x11e686 runnable [0x00007fa2b0a1b000]
java.lang.Thread.State: RUNNABLE

# SafepointSynchronize::begin: (End of list)

由上述log可看出Thread redisson-netty-2-51進入Safe Point Timeout。