Netty client (io.netty.util.internal.OutOfDirectMemoryError)

2,036 views
Skip to first unread message

vu3...@gmail.com

unread,
Aug 5, 2016, 6:45:14 AM8/5/16
to Netty discussions
Hi ,

I am facing the following out of memory issue .
This is happening from my client .Could you please let me know some fine tuning options ...


io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 922746880, max: 928514048)
at io.netty.util.internal.PlatformDependent.incrementMemoryCounter(PlatformDependent.java:613)
at io.netty.util.internal.PlatformDependent.allocateDirectNoCleaner(PlatformDependent.java:567)
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:686)
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:675)
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:237)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:221)
at io.netty.buffer.PoolArena.allocate(PoolArena.java:141)
at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:262)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179)
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:170)
at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:131)
at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:73)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:111)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:571)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:512)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:426)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:398)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
regards
Mahesh

Chris Conroy

unread,
Aug 8, 2016, 8:11:57 PM8/8/16
to Netty discussions
I encountered a similar issue recently. Are you using the UnpooledByteBufAllocator by any chance? If so, you need to carefully tune (or just disable) the Recycler parameters. Also, a few changes recently landed including lower defaults for the recycler memory usage. You can disable the recycler by setting  the JVM flag -Dio.netty.recycler.maxCapacity=0

You can see the original discussion here: https://groups.google.com/forum/#!topic/netty/Ve4lnRvFXjM
Reply all
Reply to author
Forward
0 new messages