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, &quot;Trustin Lee (ÀÌÈñ½Â)&quot; <span dir="ltr">&lt;<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>&gt;</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. &nbsp;The channel&#39;s interestOps is 5<br>
(OP_READ + OP_WRITE), which means the channel&#39;s socket send buffer is<br>
full. &nbsp;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? &nbsp;It&#39;s perhaps because the server is not<br>
reading the data you are sending at all. &nbsp;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&#39;ve sent. &nbsp;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. &nbsp;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&#39;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>
&gt; sorry, i meant -Xmx16m<br>
&gt;<br>
&gt;<br>
&gt; On Jan 27, 2010, at 2:13 PM, &nbsp;wrote:<br>
&gt;<br>
&gt;&gt; here is the heap dump for -Xmx96m:<br>
&gt;&gt; <a href="http://tinyurl.com/yeggxb7" target="_blank">http://tinyurl.com/yeggxb7</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Jan 27, 2010, at 12:53 PM, Trustin Lee (ÀÌÈñ½Â) wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Oh, that&#39;s too bad. &nbsp;Then could you post the heap dump file? &nbsp;You can<br>
&gt;&gt;&gt; configure your VM to generate heap dump on OutOfMemoryError:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp;-XX:+HeapDumpOnOutOfMemoryError<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; For more information on generating heap dump, read this article:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp;<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>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I would still recommend to decrease the max heap size so that you can<br>
&gt;&gt;&gt; get OOME sooner so that heap dump is generated sooner.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; cyrus77 wrote:<br>
&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks for your reply,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Unfortunately yes, I get OutOfMemoryError.<br>
&gt;&gt;&gt;&gt; How can we investigate it? any idea?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks,<br>
&gt;&gt;&gt;&gt; Cyrus<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Jan 27, 2010, at 11:31 AM, Trustin Lee [via Netty Forums and Mailing Lists] wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; If you do not get an OutOfMemoryError, it is safe to decrease the<br>
&gt;&gt;&gt;&gt;&gt; maximum heap size of the VM with -Xmx option. &nbsp;I&#39;d cut down to 96MB<br>
&gt;&gt;&gt;&gt;&gt; (i.e. -Xmx96m).<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; If you get an OutOfMemoryError eventually, that&#39;s more like a memory<br>
&gt;&gt;&gt;&gt;&gt; leak that needs more investigation.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; cyrus77 wrote:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I am using Netty to develop a simple TCP client and connect to a server to<br>
&gt;&gt;&gt;&gt;&gt;&gt; receive data 24x7. The data being transferred is not much, its around 100KB<br>
&gt;&gt;&gt;&gt;&gt;&gt; to 200KB per minute.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; The problem is that the client starts allocating memory gradually and after<br>
&gt;&gt;&gt;&gt;&gt;&gt; some hours or a day (depending on how much data is being sent by the server<br>
&gt;&gt;&gt;&gt;&gt;&gt; to this client) the allocated heap memory reaches up to 500 MB!<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; The thing is that even if I do nothing with the message (do nothing in<br>
&gt;&gt;&gt;&gt;&gt;&gt; messageReceived method) the problem still exist!<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I attached the code if you would like to take a look.<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://n2.nabble.com/file/n4466226/code.java" target="_blank">http://n2.nabble.com/file/n4466226/code.java</a> code.java<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Do you have any idea what is wrong with it?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Thanks,<br>
&gt;&gt;&gt;&gt;&gt;&gt; Cyrus<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt; what we call human nature in actuality is human habit<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; netty-users mailing list<br>
&gt;&gt;&gt;&gt;&gt; [hidden email]<br>
&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; signature.asc (268 bytes) Download Attachment<br>
&gt;&gt;&gt;&gt;&gt; &mdash; Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; 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>
&gt;&gt;&gt;&gt;&gt; To unsubscribe from increasing memory usage, click here.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; what we call human nature in actuality is human habit<br>
&gt;&gt;&gt; <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &lt;signature.asc&gt;_______________________________________________<br>
&gt;&gt;&gt; netty-users mailing list<br>
&gt;&gt;&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; netty-users mailing list<br>
&gt;&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; ------------------------------------------------------------------------<br>
<div class="im">&gt;<br>
&gt; _______________________________________________<br>
&gt; netty-users mailing list<br>
&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt; <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>