NIO OutOfMemory Errors with HexDumpProxy example

Erick Lichtas elichtas at linoma.com
Tue Aug 17 12:06:15 EDT 2010


Thanks so much for the reply Trustin.  I will file an issue and attach the code shortly.

Erick

-----Original Message-----
From: netty-users-bounces at lists.jboss.org [mailto:netty-users-bounces at lists.jboss.org] On Behalf Of "??? (Trustin Lee)"
Sent: Monday, August 16, 2010 1:21 AM
To: netty-users at lists.jboss.org
Subject: Re: NIO OutOfMemory Errors with HexDumpProxy example

Hi Erick,

Sorry for a late response.  Could you file a JIRA issue and attach the test code that reproduces the problem?

    https://jira.jboss.org/jira/browse/NETTY

Thanks in advance,
Trustin

On 07/30/2010 04:28 AM, Erick Lichtas wrote:
> Hi everyone,
> 
>  
> 
> I am experiencing out of memory issues with Netty when it is used as a 
> proxy server with NIO.
> 
>  
> 
> Jul 29, 2010 2:13:54 PM org.jboss.netty.channel.socket.nio.NioWorker
> 
> WARNING: Unexpected exception in the selector loop.
> 
> java.lang.OutOfMemoryError: Java heap space
> 
>       at
> org.jboss.netty.buffer.HeapChannelBuffer.<init>(_HeapChannelBuffer.jav
> a:49_)
> 
>       at
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer.<init>(_BigEndianHea
> pChannelBuffer.java:39_)
> 
>       at
> org.jboss.netty.buffer.ChannelBuffers.buffer(_ChannelBuffers.java:131_
> )
> 
>       at
> org.jboss.netty.buffer.HeapChannelBufferFactory.getBuffer(_HeapChannel
> BufferFactory.java:72_)
> 
>       at
> org.jboss.netty.buffer.AbstractChannelBufferFactory.getBuffer(_Abstrac
> tChannelBufferFactory.java:53_)
> 
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.read(_NioWorker.java:298_
> )
> 
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(_NioW
> orker.java:275_)
> 
>       at
> org.jboss.netty.channel.socket.nio.NioWorker.run(_NioWorker.java:196_)
> 
>       at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(_IoWorkerRunnable.j
> ava:46_)
> 
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(_ThreadPoolExec
> utor.java:886_)
> 
>       at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(_ThreadPoolExecutor
> .java:908_)
> 
>       at java.lang.Thread.run(_Thread.java:619_)
> 
>  
> 
> I have an example program that I would like to send, but I’m not sure 
> if I can send it directly to the user mailing list, or if I must open 
> a case in order post the code.  Please advise.
> 
>  
> 
> In my example, I have a simple TestServer and TestClient.  The server 
> is a simple server based on plain old Java sockets.  When the 
> TestClient downloads directly (no proxy) from the TestServer with 5 or 
> so concurrent clients, the files are downloaded with minimum amount of 
> memory and seems is able to handle any amount of data without any issues.
> 
>  
> 
> When I use Netty’s HexDumpProxy example as my proxy server (slightly 
> modified to toggle throttling) to connect to the TestServer, I 
> experience the OOM rather quickly.  I  and using the same TestClient 
> app, simply adjusted to connect through the proxy instead of direct.  
> A timer has been set up in the HexDumpProxy to display the memory 
> usage information to the console every 5 seconds, which displays the 
> memory usage growing out of control.  I’m guessing this is due to the 
> messages queuing up faster than the client can read them.  However, 
> even after adding throttling to the HexDumpProxyInboundHandler to 
> suspend the reading when the inboundChannel is not writeable, the 
> proxy still runs out of memory.
> 
>  
> 
> Netty Versions:                tested both *netty-3.1.5.GA.jar *and
> *netty-3.2.1.Final.jar*
> 
> Java Version:                     JDK 1.6.0_13
> 
> JRE Memory:                     128MB max (-Xmx128M)
> 
>  
> 
> Because of this, I am currently stuck with using OIO, but need to use 
> NIO for scalability reasons.  I am wondering if this is a bug in 
> Netty, and if so, should I open an issue?  Please let me know where I 
> can send the example code.
> 
>  
> 
> Kind regards,
> 
>  
> 
> E R I C K   L I C H T A S
> 
> Linoma Software
> 
> p. 402.944.4242 x714
> 
> f. 402.944.4243
> 
> www.LinomaSoftware.com <http://www.linomasoftware.com/>
> 
> www.GoAnywhereMFT.com <http://www.goanywheremft.com/>
> 
>  
> 
> 
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

--
what we call human nature in actuality is human habit http://gleamynode.net/





More information about the netty-users mailing list