JVM崩溃时java.nio.DirectByteBuffer试图释放内存在GC

问题描述:

当我运行的Apache星火工作,输入数据的这几行中,执行JVM崩溃的原因在GC免费java.nio.DirectByteBufferJVM崩溃时java.nio.DirectByteBuffer试图释放内存在GC

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) 
j sun.misc.Unsafe.freeMemory(J)V+0 
j java.nio.DirectByteBuffer$Deallocator.run()V+17 
J 1537 C1 java.lang.ref.Reference.tryHandlePending(Z)Z (115 bytes) @ 0x00007f082d519f94 [0x00007f082d5199c0+0x5d4] 
j java.lang.ref.Reference$ReferenceHandler.run()V+1 
v ~StubRoutines::call_stub 

也没有内存压力:

Heap: 
par new generation total 153344K, used 17415K [0x0000000738000000, 0x0000000742660000, 0x0000000742660000) 
eden space 136320K, 1% used [0x0000000738000000, 0x00000007381955c8, 0x0000000740520000) 
from space 17024K, 92% used [0x0000000740520000, 0x000000074148c778, 0x00000007415c0000) 
to space 17024K, 0% used [0x00000007415c0000, 0x00000007415c0000, 0x0000000742660000) 
concurrent mark-sweep generation 
total 2057856K, used 76674K [0x0000000742660000, 0x00000007c0000000, 0x00000007c0000000) 
Metaspace  used 49890K, capacity 50454K, committed 50540K, reserved 1093632K 
class space  used 6821K, capacity 6995K, committed 7056K, reserved 1048576K 

完全hs_err文件: http://www.evernote.com/l/AAQu5abObUND5KFJbFNO9RpVfLQlBiwX6gg/

+2

我投票以关闭这个问题作为脱离主题,因为堆栈溢出不是一个调试服务。 – immibis

+0

这是最像JVM或Apache Spark中的错误。该错误表明它试图释放一些未被分配的东西。 –

+1

或双重空闲,这可能是由使用内部API释放DBB和参考处理程序之间的竞争造成的。 – the8472

随着@ the8472的建议下,我尝试BTrac e并计算出DirectByteBuffer正在使用默认的Kyro串行器。 因此,我添加了自己的Kyro序列化程序来处理avro数据,现在一切正常。

你试图用sun.misc.Unsafe api来解决内存问题,导致分段错误,从而导致jvm崩溃。

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) 

Ĵsun.misc.Unsafe.freeMemory(J)V + 0 Ĵjava.nio.DirectByteBuffer $ Deallocator.run()V + 17 Ĵ1537 C1 java.lang.ref.Reference.tryHandlePending (Z)Z(115个字节)@ 0x00007f082d519f94 [0x00007f082d5199c0 + 0x5d4] Ĵjava.lang.ref.Reference中$ ReferenceHandler.run()v + 1个 v〜StubRoutines :: call_stub`

+0

是的,这是因为我试图使用'DirectByteBuffer'来减速器侧的数据结构。 – gpcuster