<p>I am not sure I agree with the solution, but I appreciate the short article on threads.</p>
<p>Personally, I had to deal with this non-termination issue, I just ensured to terminate all this stuff ;-) What I think Netty should <a href="http://give.us">give.us</a> is a really simple way to do a global release of resources. </p>
<div class="gmail_quote">On 18-May-2011 10:49 PM, "dcerisano" <<a href="mailto:dcerisano@yahoo.com">dcerisano@yahoo.com</a>> wrote:<br type="attribution">> Daemons & Zombies 101<br>> <br>> By shutting down, I assume you mean exiting the JVM (via jmx, eg.)<br>
> Two things to know about shutting down a JVM:<br>> <br>> 1) The JVM will kill all daemonized threads on exit.<br>> 2) The JVM can hang on any non-daemonized threads on exit.<br>> 3) A hung JVM is a zombie with a death-grip on ports, preventing restart.<br>
> <br>> So, you should daemonize all your netty threads, and any other threads you<br>> create.<br>> There are several ways to do this, and the API is daemon-aware where it<br>> needs to be.<br>> <br>> I believe that netty should create only daemon threads by default, but the<br>
> opposite is currently the case. I have successfully daemonized all threads<br>> (netty, timers, etc) in my JVM and it now exits cleanly every time.<br>> <br>> This is very important for those building fault-tolerant high availability<br>
> systems which must include fail-over mechanisms like auto-restarting<br>> (bouncing) a JVM.<br>> <br>> Hope this helps - it was a real nasty one to figure out. The good news is:<br>> Hung JVM? Daemonize your threads.<br>
> <br>> <br>> <br>> -----<br>> Dominic Cerisano Senior Systems Consultant Email: <a href="mailto:dcerisano@yahoo.com">dcerisano@yahoo.com</a> <a href="http://ca.linkedin.com/in/dcerisano">http://ca.linkedin.com/in/dcerisano</a> Standard3D See who we know in common Want a signature like this? <br>
> --<br>> View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Stuck-in-an-infinite-loop-inside-Netty-when-shutting-down-NIO-client-tp5761639p6378658.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Stuck-in-an-infinite-loop-inside-Netty-when-shutting-down-NIO-client-tp5761639p6378658.html</a><br>
> Sent from the Netty User Group mailing list archive at Nabble.com.<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">https://lists.jboss.org/mailman/listinfo/netty-users</a><br></div>