Stuck in an infinite loop inside Netty when shutting down NIO client

dcerisano dcerisano at yahoo.com
Wed May 18 13:18:56 EDT 2011


Daemons & Zombies 101

By shutting down, I assume you mean exiting the JVM (via jmx, eg.)
Two things to know about shutting down a JVM:

1) The JVM will kill all daemonized threads on exit.
2) The JVM can hang on any non-daemonized threads on exit.
3) A hung JVM is a zombie with a death-grip on ports, preventing restart.

So, you should daemonize all your netty threads, and any other threads you
create.
There are several ways to do this, and the API is daemon-aware where it
needs to be.

I believe that netty should create only daemon threads by default, but the
opposite is currently the case. I have successfully daemonized all threads
(netty, timers, etc) in my JVM and it now exits cleanly every time.

This is very important for those building fault-tolerant high availability
systems which must include fail-over mechanisms like auto-restarting
(bouncing) a JVM.

Hope this helps - it was a real nasty one to figure out. The good news is:
Hung JVM? Daemonize your threads.



-----
               Dominic Cerisano        Senior Systems Consultant                                                                                                                                       Email: dcerisano at yahoo.com                            http://ca.linkedin.com/in/dcerisano                                                 Standard3D                                                                                                  See who we know in common      Want a signature like this?      
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Stuck-in-an-infinite-loop-inside-Netty-when-shutting-down-NIO-client-tp5761639p6378658.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list