Le 10/06/16 à 08:23, Claude Warren a écrit : > hu_yang3000 mentions 100% CPU usage. There *is* a 100% CPU usage bug due to some 10 years old bug in the NIO library. There is no way to get this fixed, even if this has been asked MANY times to Sun/Oracle.
This occurs because at some point, during some specific conditions, the selector is spinning, returning with a 0 value without waiting for the given timeout. Obviously, having 0 event to deal with, we reenter the select() immediately, and it loops forever, eating 100% of the CPU. The workaround is to doom the selector and register all the keys on this new selector. That is what the code is doing. You can try writing a test for that, but again, there is no deterministic ways to get the problem trigerred. FTR, this issue did not only affect MINA, Netty was also affected (see https://github.com/netty/netty/issues/327). The solution was suggested by Jean-François Arcand, who was working on Grizzly