You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NioSocketChannel$WriteRequestQueue has no limit and is causing OutOfMemory #574
I am using Netty to perform large file upload. It works fine but the RAM used by the client seems to increase with the size of the file. This is not the expected behaviour since everything is piped from the Reading the source file to writing the target file.
At first, I thought about a kind of adaptive buffer growing up until Xmx is reached but setting Xmx to a reasonable value (50M) would lead to an OutOfMemoryError soon after starting upload. After some research using Eclipse Memory Analyzer, it appears that the object retaining the heap memory is:
Is this the expected behaviour, is there any option for setting a limit to this queue or do I have to code my own queue using ChannelFutures to control the number of bytes and block the pipe when the limit is reached?
@rpelissier you should use Channel.isWritable() to check if the "queue" is full. If so you will need to check if there is enough space to write more. So the effect you see can happen if you write data to quickly to get it send out to the clients.
You can get around this kind of problems when try to write a File via DefaultFileRegion or ChunkedFile.
Activity
normanmaurer commentedon Aug 29, 2012
@rpelissier you should use Channel.isWritable() to check if the "queue" is full. If so you will need to check if there is enough space to write more. So the effect you see can happen if you write data to quickly to get it send out to the clients.
You can get around this kind of problems when try to write a File via DefaultFileRegion or ChunkedFile.
rpelissier commentedon Aug 29, 2012
@normanmaurer thank you I missed this method of the Channel!
I guess I need to read what's happening inside:
Prevent JNI classloader leak (netty#574)