xmemcached icon indicating copy to clipboard operation
xmemcached copied to clipboard

XMemcached network layout exception: java.lang.OutOfMemoryError: Direct buffer memory

Open sfxnmadu opened this issue 4 years ago • 1 comments

Hello, We use memcached v2.4.6, and are currently getting the below error:

09-06-2020 09:36:34,934 ERROR MemcachedHandler:128 - XMemcached network layout exception: java.lang.OutOfMemoryError: Direct buffer memory at java.nio.Bits.reserveMemory(Bits.java:694) at java.nio.DirectByteBuffer.(DirectByteBuffer.java:123) at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311) at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:241) at sun.nio.ch.IOUtil.read(IOUtil.java:195) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:190) at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:184) at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:324) at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:54) at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:150) at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:310) at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:177)

I reckon this might be similar to the issue in raised here, but I will appreciate specific insights on how to address this problem for this type of OOME - Direct buffer memory. And yes, we do use the xmemcached client as a singleton instance.

Thank you

sfxnmadu avatar Jun 10 '20 10:06 sfxnmadu

It seems that you may have too many connections ,every connection will keep an read direct buffer. You can increase the max direct buffer size or decrease the connection pool size.

killme2008 avatar Jan 06 '21 02:01 killme2008