Linux
Java 1.6.0_03
Mina 2.0 trunk
I've run into a difficult to reproduce problem when using NioConnector. The
setup looks something like this (if I'm doing something wrong let me know)
NioConnector connector = new NioConnector(4)
connector.getFilterChain().addLast("protocolFilter", new
ProtocolCodecFilter(encoder, decoder));
connector.setHandler(new Handler());
Here is sessionOpened fromt he Handler.
public void sessionOpened(IoSession session) {
session.write(...);
}
Both sessionCreated() and sessionOpened() are called and I know that the
request is written. But no other handler methods are ever called
(messageReceived, sessionIdle, exceptionCaught, or sessionClosed). Now
this happens only very rarely, probably < 1% of the time, under heavy load.
I did a thread dump and noticed that each time this occurred there was a
NioProcessor still executing, and it never exited. With some well placed
debugging I was able to determine that inside the
AbstractPollingIoProcecess$Worker.run() the nSession local is 1 and never
changes, so the Worker never exits. Also allSessions() returns no
sessions. So it seems as though the session has just disappeared.
I've tried to create a small test case that reproduces this problem but
haven't yet been able to. If I can create one I will post it. If I can
provide any additional information please let me know.
Thanks,
-geoff