<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, &quot;dcerisano&quot; &lt;<a href="mailto:dcerisano@yahoo.com">dcerisano@yahoo.com</a>&gt; wrote:<br type="attribution">&gt; Daemons &amp; Zombies 101<br>&gt; <br>&gt; By shutting down, I assume you mean exiting the JVM (via jmx, eg.)<br>
&gt; Two things to know about shutting down a JVM:<br>&gt; <br>&gt; 1) The JVM will kill all daemonized threads on exit.<br>&gt; 2) The JVM can hang on any non-daemonized threads on exit.<br>&gt; 3) A hung JVM is a zombie with a death-grip on ports, preventing restart.<br>
&gt; <br>&gt; So, you should daemonize all your netty threads, and any other threads you<br>&gt; create.<br>&gt; There are several ways to do this, and the API is daemon-aware where it<br>&gt; needs to be.<br>&gt; <br>&gt; I believe that netty should create only daemon threads by default, but the<br>
&gt; opposite is currently the case. I have successfully daemonized all threads<br>&gt; (netty, timers, etc) in my JVM and it now exits cleanly every time.<br>&gt; <br>&gt; This is very important for those building fault-tolerant high availability<br>
&gt; systems which must include fail-over mechanisms like auto-restarting<br>&gt; (bouncing) a JVM.<br>&gt; <br>&gt; Hope this helps - it was a real nasty one to figure out. The good news is:<br>&gt; Hung JVM? Daemonize your threads.<br>
&gt; <br>&gt; <br>&gt; <br>&gt; -----<br>&gt;                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>
&gt; --<br>&gt; 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>
&gt; Sent from the Netty User Group mailing list archive at Nabble.com.<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">https://lists.jboss.org/mailman/listinfo/netty-users</a><br></div>