OOT question, may I ask which tool did you use to analyze the heap dump?<br><br><div class="gmail_quote">On Wed, Jan 27, 2010 at 10:12 PM, "Trustin Lee (ÀÌÈñ½Â)" <span dir="ltr"><<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">According to the heap dump, a lot of buffers are stuck in the event<br>
queue of a NioClientSocketChannel. The channel's interestOps is 5<br>
(OP_READ + OP_WRITE), which means the channel's socket send buffer is<br>
full. Because your write request cannot be completed due to the full<br>
socket buffer, it will be kept in the event queue and eventually cause OOME.<br>
<br>
Why is the socket buffer full? It's perhaps because the server is not<br>
reading the data you are sending at all. You have to disconnect or stop<br>
sending data in such a case.<br>
<br>
Generally, such a problematic server does not send a response message<br>
for the message you've sent. You could maintain an integer variable<br>
that counts the number of unanswered requests and disconnect if the<br>
counter becomes greater than a certain threshold. In a normal<br>
connection, the counter will be increased and then decreased because the<br>
responses will be received fairly quickly.<br>
<br>
Just in case you think the server is just fine and something's wrong<br>
with Netty, provide me the full source code of the client-server pair<br>
that reproduces the problem.<br>
<br>
HTH,<br>
<font color="#888888">Trustin<br>
</font><div><div></div><div class="h5"><br>
Mahmood Rahmani wrote:<br>
> sorry, i meant -Xmx16m<br>
><br>
><br>
> On Jan 27, 2010, at 2:13 PM, wrote:<br>
><br>
>> here is the heap dump for -Xmx96m:<br>
>> <a href="http://tinyurl.com/yeggxb7" target="_blank">http://tinyurl.com/yeggxb7</a><br>
>><br>
>><br>
>><br>
>> On Jan 27, 2010, at 12:53 PM, Trustin Lee (ÀÌÈñ½Â) wrote:<br>
>><br>
>>> Oh, that's too bad. Then could you post the heap dump file? You can<br>
>>> configure your VM to generate heap dump on OutOfMemoryError:<br>
>>><br>
>>> -XX:+HeapDumpOnOutOfMemoryError<br>
>>><br>
>>> For more information on generating heap dump, read this article:<br>
>>><br>
>>> <a href="http://blogs.sun.com/alanb/entry/heap_dumps_are_back_with" target="_blank">http://blogs.sun.com/alanb/entry/heap_dumps_are_back_with</a><br>
>>><br>
>>> I would still recommend to decrease the max heap size so that you can<br>
>>> get OOME sooner so that heap dump is generated sooner.<br>
>>><br>
>>> cyrus77 wrote:<br>
>>>> Hi,<br>
>>>><br>
>>>> Thanks for your reply,<br>
>>>><br>
>>>> Unfortunately yes, I get OutOfMemoryError.<br>
>>>> How can we investigate it? any idea?<br>
>>>><br>
>>>> Thanks,<br>
>>>> Cyrus<br>
>>>><br>
>>>><br>
>>>> On Jan 27, 2010, at 11:31 AM, Trustin Lee [via Netty Forums and Mailing Lists] wrote:<br>
>>>><br>
>>>>> If you do not get an OutOfMemoryError, it is safe to decrease the<br>
>>>>> maximum heap size of the VM with -Xmx option. I'd cut down to 96MB<br>
>>>>> (i.e. -Xmx96m).<br>
>>>>><br>
>>>>> If you get an OutOfMemoryError eventually, that's more like a memory<br>
>>>>> leak that needs more investigation.<br>
>>>>><br>
>>>>> cyrus77 wrote:<br>
>>>>><br>
>>>>>> Hi,<br>
>>>>>><br>
>>>>>> I am using Netty to develop a simple TCP client and connect to a server to<br>
>>>>>> receive data 24x7. The data being transferred is not much, its around 100KB<br>
>>>>>> to 200KB per minute.<br>
>>>>>><br>
>>>>>> The problem is that the client starts allocating memory gradually and after<br>
>>>>>> some hours or a day (depending on how much data is being sent by the server<br>
>>>>>> to this client) the allocated heap memory reaches up to 500 MB!<br>
>>>>>><br>
>>>>>> The thing is that even if I do nothing with the message (do nothing in<br>
>>>>>> messageReceived method) the problem still exist!<br>
>>>>>><br>
>>>>>> I attached the code if you would like to take a look.<br>
>>>>>> <a href="http://n2.nabble.com/file/n4466226/code.java" target="_blank">http://n2.nabble.com/file/n4466226/code.java</a> code.java<br>
>>>>>><br>
>>>>>> Do you have any idea what is wrong with it?<br>
>>>>>><br>
>>>>>> Thanks,<br>
>>>>>> Cyrus<br>
>>>>>><br>
>>>>> --<br>
>>>>> what we call human nature in actuality is human habit<br>
>>>>> <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> netty-users mailing list<br>
>>>>> [hidden email]<br>
>>>>> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
>>>>><br>
>>>>> signature.asc (268 bytes) Download Attachment<br>
>>>>> — Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
>>>>><br>
>>>>><br>
>>>>> View message @ <a href="http://n2.nabble.com/increasing-memory-usage-tp4466226p4466366.html" target="_blank">http://n2.nabble.com/increasing-memory-usage-tp4466226p4466366.html</a><br>
>>>>> To unsubscribe from increasing memory usage, click here.<br>
>>>>><br>
>>>><br>
>>> --<br>
>>> what we call human nature in actuality is human habit<br>
>>> <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
>>><br>
>>><br>
>>> <signature.asc>_______________________________________________<br>
>>> netty-users mailing list<br>
>>> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
>>> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
>> _______________________________________________<br>
>> netty-users mailing list<br>
>> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
><br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
<div class="im">><br>
> _______________________________________________<br>
> netty-users mailing list<br>
> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
<br>
</div><div><div></div><div class="h5">--<br>
what we call human nature in actuality is human habit<br>
<a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
<br>
<br>
</div></div><br>_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br></blockquote></div><br>