性能问答>诡异的OutOfMemoryError: Java heap space>
14回复
2年前

诡异的OutOfMemoryError: Java heap space



待检查的参数

-server
-Xmx8192m
-Xms8192m
-Xmn3072m
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
-XX:+DisableExplicitGC
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:LargePageSizeInBytes=128m
-XX:+UseFastAccessorMethods
-XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=75
-XX:TargetSurvivorRatio=85
-XX:+PrintGCDetails
-XX:+PrintHeapAtGC
-XX:+PrintReferenceGC
-XX:+PrintGCDateStamps
-XX:-UseCompressedClassPointers

heap信息:
image.png

gc信息:

2020-08-10T15:50:47.362+0800: 1733031.089: [GC (Allocation Failure) 2020-08-10T15:50:47.363+0800: 1733031.089: [ParNew2020-08-10T15:50:47.367+0800: 1733031.094: [SoftReference, 0 refs, 0.0000381 secs]2020-08-10T15:50:47.367+0800: 1733031.094: [WeakReference, 7 refs, 0.0000132 secs]2020-08-10T15:50:47.367+0800: 1733031.094: [FinalReference, 9 refs, 0.0000209 secs]2020-08-10T15:50:47.367+0800: 1733031.094: [PhantomReference, 0 refs, 0 refs, 0.0000167 secs]2020-08-10T15:50:47.367+0800: 1733031.094: [JNI Weak Reference, 0.0000385 secs]: 2527446K->2908K(2831168K), 0.0048404 secs] 2640322K->115784K(8074048K), 0.0050091 secs] [Times: user=0.11 sys=0.00, real=0.00 secs] 
Heap after GC invocations=4399 (full 324):
 par new generation   total 2831168K, used 2908K [0x0000000600000000, 0x00000006c0000000, 0x00000006c0000000)
  eden space 2516608K,   0% used [0x0000000600000000, 0x0000000600000000, 0x00000006999a0000)
  from space 314560K,   0% used [0x00000006999a0000, 0x0000000699c77320, 0x00000006accd0000)
  to   space 314560K,   0% used [0x00000006accd0000, 0x00000006accd0000, 0x00000006c0000000)
 concurrent mark-sweep generation total 5242880K, used 112876K [0x00000006c0000000, 0x0000000800000000, 0x0000000800000000)
 Metaspace       used 102087K, capacity 107447K, committed 107776K, reserved 108544K
}
{Heap before GC invocations=4399 (full 324):
 par new generation   total 2831168K, used 2519516K [0x0000000600000000, 0x00000006c0000000, 0x00000006c0000000)
  eden space 2516608K, 100% used [0x0000000600000000, 0x00000006999a0000, 0x00000006999a0000)
  from space 314560K,   0% used [0x00000006999a0000, 0x0000000699c77320, 0x00000006accd0000)
  to   space 314560K,   0% used [0x00000006accd0000, 0x00000006accd0000, 0x00000006c0000000)
 concurrent mark-sweep generation total 5242880K, used 112876K [0x00000006c0000000, 0x0000000800000000, 0x0000000800000000)
 Metaspace       used 102087K, capacity 107447K, committed 107776K, reserved 108544K
2020-08-10T15:56:41.061+0800: 1733384.787: [GC (Allocation Failure) 2020-08-10T15:56:41.061+0800: 1733384.787: [ParNew2020-08-10T15:56:41.066+0800: 1733384.792: [SoftReference, 0 refs, 0.0000441 secs]2020-08-10T15:56:41.066+0800: 1733384.793: [WeakReference, 7 refs, 0.0000151 secs]2020-08-10T15:56:41.066+0800: 1733384.793: [FinalReference, 13 refs, 0.0000203 secs]2020-08-10T15:56:41.066+0800: 1733384.793: [PhantomReference, 0 refs, 0 refs, 0.0000166 secs]2020-08-10T15:56:41.066+0800: 1733384.793: [JNI Weak Reference, 0.0000409 secs]: 2519516K->1796K(2831168K), 0.0055085 secs] 2632392K->114672K(8074048K), 0.0056794 secs] [Times: user=0.10 sys=0.00, real=0.01 secs] 
Heap after GC invocations=4400 (full 324):
 par new generation   total 2831168K, used 1796K [0x0000000600000000, 0x00000006c0000000, 0x00000006c0000000)
  eden space 2516608K,   0% used [0x0000000600000000, 0x0000000600000000, 0x00000006999a0000)
  from space 314560K,   0% used [0x00000006accd0000, 0x00000006ace91078, 0x00000006c0000000)
  to   space 314560K,   0% used [0x00000006999a0000, 0x00000006999a0000, 0x00000006accd0000)
 concurrent mark-sweep generation total 5242880K, used 112876K [0x00000006c0000000, 0x0000000800000000, 0x0000000800000000)
 Metaspace       used 102087K, capacity 107447K, committed 107776K, reserved 108544K
}
{Heap before GC invocations=4400 (full 324):
 par new generation   total 2831168K, used 2518404K [0x0000000600000000, 0x00000006c0000000, 0x00000006c0000000)
  eden space 2516608K, 100% used [0x0000000600000000, 0x00000006999a0000, 0x00000006999a0000)
  from space 314560K,   0% used [0x00000006accd0000, 0x00000006ace91078, 0x00000006c0000000)
  to   space 314560K,   0% used [0x00000006999a0000, 0x00000006999a0000, 0x00000006accd0000)
 concurrent mark-sweep generation total 5242880K, used 112876K [0x00000006c0000000, 0x0000000800000000, 0x0000000800000000)
 Metaspace       used 102090K, capacity 107447K, committed 107776K, reserved 108544K
2020-08-10T16:00:56.201+0800: 1733639.928: [GC (Allocation Failure) 2020-08-10T16:00:56.201+0800: 1733639.928: [ParNew2020-08-10T16:00:56.206+0800: 1733639.933: [SoftReference, 0 refs, 0.0000407 secs]2020-08-10T16:00:56.206+0800: 1733639.933: [WeakReference, 15 refs, 0.0000141 secs]2020-08-10T16:00:56.206+0800: 1733639.933: [FinalReference, 20 refs, 0.0000202 secs]2020-08-10T16:00:56.206+0800: 1733639.933: [PhantomReference, 1 refs, 0 refs, 0.0000147 secs]2020-08-10T16:00:56.206+0800: 1733639.933: [JNI Weak Reference, 0.0000371 secs]: 2518404K->1392K(2831168K), 0.0050852 secs] 2631280K->114268K(8074048K), 0.0052496 secs] [Times: user=0.11 sys=0.00, real=0.00 secs]

从内存信息和gc信息看,可用内存都是充足的,但是任何操作都会报出如下信息:
Caused by:

org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.lang.OutOfMemoryError: Java heap space
        at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:68)
        at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:35)
        at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.serialize(JdkSerializationRedisSerializer.java:94)
        ... 33 common frames omitted
Caused by: java.lang.OutOfMemoryError: Java heap space

请大神帮忙分析分析,不胜感激!

4183 阅读
请先登录,查看14条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步