Hi Trustin,<div>I tried your suggested changes (3) and redeployed - unfortunately I dont get much time in this environment as it is actively being used. It turned out that for some reason part of the system didn&#39;t behave as expected so we had a malfunction rolled back the changes (and use channel future with timeout) - its very weird and only happens in this environment. Sorry I cant be much more help than that at the moment. When I first implemented a workaround I found that logging on the underlying socket (using setAccessible) - said the connection was notClosed, but notBound (i.e. it was open) and netty was reported it was, notBound, notConnected etc.</div>
<div><br></div><div>I will report more findings next week,</div><div>Best Regards,</div><div>Neil.<br><br><div class="gmail_quote">On Thu, May 27, 2010 at 2:21 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="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Neil,<br>
<br>
That doesn&#39;t sound right.  It would be great if you try a couple things<br>
for me to track down the problem:<br>
<br>
1) After calling Channel.close() for the leaked connection, what do<br>
isOpen(), isBound(), and isConnected() return?<br>
<br>
2) Could you increase the connect future timeout and dump the heap while<br>
it waits for the connect future using jmap?  Once you send me the heap<br>
dump, I can understand Netty&#39;s internal status more easily.<br>
<br>
3) Could you let me know if specifying &quot;connectTimeoutMillis&quot; option<br>
instead of using future timeout fixes the problem?<br>
<br>
    bootstrap.setOption(&quot;connectTimeoutMillis&quot;, 10000);<br>
    ...<br>
    bootstrap.connect().awaitUninterruptibly(); // note no argument<br>
<br>
I believe (3) will fix your problem, but I need (1) and (2) to figure<br>
out the exact steps to reproduce the problem and fix it fundamentally.<br>
<br>
If possible, it would be very nice if I can figure out if this is a bug<br>
or not and fix it as soon as possible so that more stable CR (or Final)<br>
version is released tomorrow.<br>
<br>
Thanks,<br>
Trustin<br>
<div><div></div><div class="h5"><br>
Neil Avery wrote:<br>
&gt; All,<br>
&gt; Trustin - firstly - thanks again for such an awesome network framework -<br>
&gt; it has provided to be amazingly scalable for some of the loads we have<br>
&gt; been putting through it; 4000 servers streaming GBs of data and its been<br>
&gt; rock solid!<br>
&gt;<br>
&gt; Platform Netty 3.2RC1, RedHat Linux, Java 1.6.0_18<br>
&gt;<br>
&gt; Unfortunately we have finally hit a weird issue which only occurs on<br>
&gt; this particular platform. Using the NioClientSocketChannelFactory to<br>
&gt; create a client, after a period of use we start to experience a timeout<br>
&gt; when trying to bind. The code is standard in that it follows the<br>
&gt; tutorials and we have never seen this problem before. In this case there<br>
&gt; is little load on the system and its only sending messages to 6 peers.<br>
&gt;<br>
&gt; Now for the weird bit - there is no cause excepton() sent to the handler<br>
&gt; (our nio listener) and - when printing<br>
&gt; the channelFuture.getChannel().getLocalAddress() it prints out a valid<br>
&gt; client address. Using lsof &amp; netstat we can see the connection is<br>
&gt; actually bound. As part of the failure, we attempt to free resources for<br>
&gt; the channel and they also fail to release the bound connection...so we<br>
&gt; leak connections. Cleanup is attempted using; closeFuture =<br>
&gt; channelFuture.getChannel().close() and then wait 10seconds for the<br>
&gt; closeFuture to complete.<br>
&gt;<br>
&gt; So I guess I have 3 questions:<br>
&gt; - are we handling the connection bind correctly? - it doesnt seem for<br>
&gt; this case as it does connect the code doesnt think it has<br>
&gt; - are we handling closeDown correctly? -<br>
&gt; channelFuture.getChannel().close() doesnt seem to release these resources...<br>
&gt; - is there a brute force way to access the underlying socketChannel and<br>
&gt; attempt to release it?<br>
&gt;<br>
&gt; Any help appreciated,<br>
&gt; Regard Neil.<br>
&gt;<br>
&gt;         ClientBootstrap bootstrap = new ClientBootstrap(nettyClientfactory);<br>
&gt;         handler = new NettyClientHandler(uri);<br>
&gt;         bootstrap.getPipeline().addLast(HANDLER, handler);<br>
&gt;         bootstrap.setOption(TCP_NO_DELAY, true);<br>
&gt;         bootstrap.setOption(KEEP_ALIVE, true);<br>
&gt;<br>
&gt; channelFuture = bootstrap.connect(new InetSocketAddress(uri.getHost(),<br>
&gt; uri.getPort()));<br>
&gt;<br>
&gt;         try {<br>
&gt;          boolean success = channelFuture.await(10, TimeUnit.SECONDS);<br>
&gt; if (!success) {<br>
&gt;     if (handler.getException() != null) {<br>
&gt; throw new RuntimeException(String.format(&quot;%s\n Failed to establish<br>
&gt; Connection within %d secs:%s&quot;, this.toString(),<br>
&gt; connectionEstablishTimeout, uri), handler.getException()); } else {<br>
&gt; throw new RuntimeException(String.format(&quot;%s\n Failed to establish<br>
&gt; Connection within %d secs:%s&quot;, this.toString(),<br>
&gt; connectionEstablishTimeout, uri)); }<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
</div></div>&gt; <a href="http://www.liquidlabs.co.uk" target="_blank">www.liquidlabs.co.uk</a> &lt;<a href="http://www.liquidlabs.co.uk" target="_blank">http://www.liquidlabs.co.uk</a>&gt;<br>
&gt;<br>
&gt;<br>
&gt; ------------------------------------------------------------------------<br>
&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>
<font color="#888888"><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>
</font><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><br clear="all"><br>-- <br><br><a href="http://www.liquidlabs.co.uk">www.liquidlabs.co.uk</a><br>

</div>