I guess, when a burst of datagram packets are received, Netty allocates
many 64KiB buffers for a very short peroid of time and that could lead
to OOME.
Could you try to limit the maximum number of reads in
AbstractNioMessageChannel.java?
https://github.com/netty/netty/blob/master/transport/src/main/java/io/netty/channel/nio/AbstractNioMessageChannel.java#L63
It's currently an infinite loop, so I believe there's a chance it will
allocate too many 64K buffers before triggering a messageReceived
event. Before making a related change, I'd like to get your
confirmation.
Thanks,
T
On Fri 21 Jun 2013 10:01:41 AM KST, Dan Tran wrote:
> One more fact.
>
> I dont see problem at my Centos 6.4 with OpenJdk 7
>
> -D
>
>
> On Thu, Jun 20, 2013 at 9:42 AM, Dan Tran <
dan...@gmail.com
> <mailto:
dan...@gmail.com>> wrote:
>
> Thanks Trustin
>
> Here are a few more details
>
> 0. I dont shutdown server udp socket when issur occur ( continue
> to serve )
> 1. My PlatformDependent.maxDirectMemory(): 1871642624
> 2. I dont disable resource leak detection
> 3. Since syslog max msg side is 60K, this is my added .option(
> ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(
> 1024 * 64 ) );
> 4. I also use .option( ChannelOption.SO_RCVBUF, if set more than
> 8M, OOM easily happen
> 5. Have not try to increase maximum direct memory of the JVM yet
>
> Thank you for helping out
>
> -Dan
>
>
> On Thu, Jun 20, 2013 at 12:41 AM, "이희승 (Trustin Lee)"
> <
t...@motd.kr <mailto:
t...@motd.kr>> wrote:
>
> Did you try to increase the maximum direct memory of the JVM?
> Could you tell me the current maximum direct memory size
> using PlatformDependent.__maxDirectMemory()?
>
> Did you disable resource leak detection?
> (-Dio.netty.__noResourceLeakDetection) If so, please enable it
> to see if there's a leak.
>
>
> On Thu 20 Jun 2013 04:17:29 PM KST, Dan Tran wrote:
>
> My issue relates to
>
https://github.com/netty/__netty/issues/1393#__issuecomment-19434569
> <mailto:
dan...@gmail.com <mailto:
dan...@gmail.com>>> wrote:
>
> This problem has been reported and fixed before CR4,
> not sure why
> it comes back again in CR4+ ( due to recent big change? )
>
> Basically, I am processing a 20Kmsg/sec with 1kMsg
> payload. All
> messages are released at the message handler.
> The processing of the payload surely take some
> processing time as
> well, and my log are flushed with the below stack
> trace. ( note
> my memory fluctuate normally )
>
> if I just discard the msg, then the problem disappears.
>
> May be this is a regression in Netty CR4+??
>
> Thanks
>
> -D
>
>
>
> 2013-06-18 17:26:18,390 | WARN | ioEventLoopGroup-3-1
> UdpSyslogHandler 59 |
> | Unexpected exception from downstream.
> java.lang.OutOfMemoryError: Direct buffer memory
> at
> java.nio.Bits.reserveMemory(__Bits.java:658)[:1.7.0_03]
> at
> java.nio.DirectByteBuffer.<__init>(DirectByteBuffer.java:__123)[:1.7.0_03]
> at
> java.nio.ByteBuffer.__allocateDirect(ByteBuffer.__java:306)[:1.7.0_03]
> at
> io.netty.buffer.PoolArena$__DirectArena.newChunk(__PoolArena.java:371)[122:io.__netty.buffer:4.0.0.CR5]
> at
> io.netty.buffer.PoolArena.__allocateNormal(PoolArena.java:__143)[122:io.netty.buffer:4.0.__0.CR5]
> at
> io.netty.buffer.PoolArena.__allocate(PoolArena.java:132)[__122:io.netty.buffer:4.0.0.CR5]
> at
> io.netty.buffer.PoolArena.__allocate(PoolArena.java:94)[__122:io.netty.buffer:4.0.0.CR5]
> at
> io.netty.buffer.__PooledByteBufAllocator.__newDirectBuffer(__PooledByteBufAllocator.java:__233)[122:io.netty.buffer:4.0.__0.CR5]
> at
> io.netty.buffer.__AbstractByteBufAllocator.__directBuffer(__AbstractByteBufAllocator.java:__130)[122:io.netty.buffer:4.0.__0.CR5]
> at
> io.netty.buffer.__AbstractByteBufAllocator.__directBuffer(__AbstractByteBufAllocator.java:__121)[122:io.netty.buffer:4.0.__0.CR5]
> at
> io.netty.buffer.__AbstractByteBufAllocator.__ioBuffer(__AbstractByteBufAllocator.java:__82)[122:io.netty.buffer:4.0.0.__CR5]
> at
> io.netty.channel.__FixedRecvByteBufAllocator$__HandleImpl.allocate(__FixedRecvByteBufAllocator.__java:38)[121:io.netty.__transport:4.0.0.CR5]
> at
> io.netty.channel.socket.nio.__NioDatagramChannel.__doReadMessages(__NioDatagramChannel.java:210)[__121:io.netty.transport:4.0.0.__CR5]
> at
> io.netty.channel.nio.__AbstractNioMessageChannel$__NioMessageUnsafe.read(__AbstractNioMessageChannel.__java:64)[121:io.netty.__transport:4.0.0.CR5]
> at
> io.netty.channel.nio.__NioEventLoop.__processSelectedKey(__NioEventLoop.java:489)[121:io.__netty.transport:4.0.0.CR5]
> at
> io.netty.channel.nio.__NioEventLoop.__processSelectedKeysOptimized(__NioEventLoop.java:464)[121:io.__netty.transport:4.0.0.CR5]
> at
> io.netty.channel.nio.__NioEventLoop.run(NioEventLoop.__java:358)[121:io.netty.__transport:4.0.0.CR5]
> at
> io.netty.util.concurrent.__SingleThreadEventExecutor$2.__run(SingleThreadEventExecutor.__java:101)[123:io.netty.common:__4.0.0.CR5]
> at
> java.lang.Thread.run(Thread.__java:722)[:1.7.0_03]
>
> --
>
> ---
> You received this message because you are subscribed
> to the Google
> Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving
> emails from it,
> send an email to netty+unsubscribe@__
googlegroups.com
> <mailto:
netty%2Bunsu...@googlegroups.com>
> <mailto:
netty%2Bunsubscribe@__
googlegroups.com
> <mailto:
netty%252Buns...@googlegroups.com>>.
>
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
>
>
> --
>
> ---
> You received this message because you are subscribed to
> the Google
> Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails
> from it, send
> an email to netty+unsubscribe@__
googlegroups.com
> <mailto:
netty%2Bunsu...@googlegroups.com>.
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
https://twitter.com/netty___project
> <
https://twitter.com/netty_project>
>
>
> --
>
> --- You received this message because you are subscribed to
> the Google Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to netty+unsubscribe@__
googlegroups.com
> <mailto:
netty%2Bunsu...@googlegroups.com>.
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
netty+un...@googlegroups.com.