All,<div>Trustin - firstly - thanks again for such an awesome network framework - it has provided to be amazingly scalable for some of the loads we have been putting through it; 4000 servers streaming GBs of data and its been rock solid!</div>
<div><br></div><div>Platform Netty 3.2RC1, RedHat Linux, Java 1.6.0_18</div><div><br></div><div>Unfortunately we have finally hit a weird issue which only occurs on this particular platform. Using the NioClientSocketChannelFactory to create a client, after a period of use we start to experience a timeout when trying to bind. The code is standard in that it follows the tutorials and we have never seen this problem before. In this case there is little load on the system and its only sending messages to 6 peers.</div>
<div><br></div><div>Now for the weird bit - there is no cause excepton() sent to the handler (our nio listener) and - when printing the channelFuture.getChannel().getLocalAddress() it prints out a valid client address. Using lsof &amp; netstat we can see the connection is actually bound. As part of the failure, we attempt to free resources for the channel and they also fail to release the bound connection...so we leak connections. Cleanup is attempted using; closeFuture = channelFuture.getChannel().close() and then wait 10seconds for the closeFuture to complete.</div>
<div><br></div><div>So I guess I have 3 questions:</div><div>- are we handling the connection bind correctly? - it doesnt seem for this case as it does connect the code doesnt think it has</div><div>- are we handling closeDown correctly? - channelFuture.getChannel().close() doesnt seem to release these resources...</div>
<div>- is there a brute force way to access the underlying socketChannel and attempt to release it?</div><div><br></div><div>Any help appreciated,</div><div>Regard Neil.</div><div><br></div><div><div>        ClientBootstrap bootstrap = new ClientBootstrap(nettyClientfactory);</div>
<div>        handler = new NettyClientHandler(uri);</div><div>        bootstrap.getPipeline().addLast(HANDLER, handler);</div><div>        bootstrap.setOption(TCP_NO_DELAY, true);</div><div>        bootstrap.setOption(KEEP_ALIVE, true);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>channelFuture = bootstrap.connect(new InetSocketAddress(uri.getHost(), uri.getPort()));</div><div>        </div><div>        try {</div><div>
        <span class="Apple-tab-span" style="white-space:pre">        </span>boolean success = channelFuture.await(10, TimeUnit.SECONDS);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>if (!success) {</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>    <span class="Apple-style-span" style="white-space: pre;">if (handler.getException() != null) {</span></div>
<div><span class="Apple-tab-span" style="white-space: pre; "></span></div><div><span class="Apple-tab-span" style="white-space: pre; "></span><span class="Apple-style-span" style="white-space: pre;">                                        throw new RuntimeException(String.format(&quot;%s\n Failed to establish Connection within %d secs:%s&quot;, this.toString(), connectionEstablishTimeout, uri), handler.getException());                                        
                                } else {
                                        throw new RuntimeException(String.format(&quot;%s\n Failed to establish Connection within %d secs:%s&quot;, this.toString(), connectionEstablishTimeout, uri));
                                }
</span></div><div><br></div></div><div><br>-- <br><br><a href="http://www.liquidlabs.co.uk">www.liquidlabs.co.uk</a><br>
</div>