I have a multi-threaded server written in non blocking NIO (one thread handles the IO) and after a while i see that it uses about 90% CPU. I managed to find the thread that causes the problem, and it is the one handling the IO but i need help understanding the reason for it, please take a look: Thanks
I noticed that the problem only started after I got a null pointer exception in the line: connectingChannel.write... The thread has a while(true) loop surrounding a try...catch... that catches this exception and continues normally.
The reason for the 90% CPU is that ioHandlerSelector.select(1000) returns immediately (after the exception), and it's surrounded by a while(true) loop (Every 1-3 ms i see a "no ready channels" msg)