killme2008 / killme2008/xmemcached

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

Open
#119 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
764
Forks
271
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/killme2008/xmemcached/issues/43), 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer and the related stack-trace entries, then compare the behavior with issue 43. Review how the singleton XMemcached client is configured and used; done means identifying the cause of the direct-buffer exhaustion and documenting a specific, reproducible mitigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, memcached
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.