迁移到jdk1.8.0_74后,JVM挂起

时间:2016-04-14 07:12:40

标签: java garbage-collection jvm

我有一个java应用程序,它曾经在java 7中运行良好。在使用以下配置迁移到java 8之后,它开始挂起。

-Xms3g -Xmx3g -verbose:gc -XX:+UseG1GC -XX:G1ReservePercent=25 -XX:+PrintGCDateStamps

我已经进行了jstack转储,它显示所有线程都处于 BLOCKED 状态。我也采用了jmap dump来显示以下信息。

有人可以帮我解决这个问题吗?

Attaching to process ID 2554, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.74-b02

using thread-local object allocation.
Garbage-First (G1) GC with 18 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 3221225472 (3072.0MB)
   NewSize                  = 1363144 (1.2999954223632812MB)
   MaxNewSize               = 1932525568 (1843.0MB)
   OldSize                  = 5452592 (5.1999969482421875MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 1048576 (1.0MB)

Heap Usage:
G1 Heap:
   regions  = 3072
   capacity = 3221225472 (3072.0MB)
   used     = 2112667712 (2014.7969360351562MB)
   free     = 1108557760 (1057.2030639648438MB)
   65.58583776156108% used
G1 Young Generation:
Eden Space:
   regions  = 1665
   capacity = 2024800256 (1931.0MB)
   used     = 1745879040 (1665.0MB)
   free     = 278921216 (266.0MB)
   86.22475401346452% used
Survivor Space:
   regions  = 5
   capacity = 5242880 (5.0MB)
   used     = 5242880 (5.0MB)
   free     = 0 (0.0MB)
   100.0% used
G1 Old Generation:
   regions  = 349
   capacity = 1191182336 (1136.0MB)
   used     = 361545792 (344.79693603515625MB)
   free     = 829636544 (791.2030639648438MB)
   30.351842960841218% used

18753 interned Strings occupying 1751224 bytes.

1 个答案:

答案 0 :(得分:0)

您需要进行线程转储并仔细分析以了解它们被卡住的位置,这很可能是代码中的线程安全问题。我们在过去从Linux 4机器迁移到Linux 6(功能强大且具有多个CPU和内核的机器)时遇到了类似的锁定问题。更快的机器可以暴露这种长期存在线程的编程错误。