dev@grizzly.java.net

Random CancelledKeyException's

From: Mark Macumber <mark.macumber_at_gmail.com>
Date: Thu, 24 Jul 2008 16:33:15 +1000

Hi Everyone,

At the moment I am trying to setup a configurable TCP server that will
process a proprietary protocol, and I am using JMeter to do some testing.

I have setup JMeter so that it fires of lots of requests on different
threads, I am doing this because I want to only allow a certain number of
connections.

While I am doing this though, I seem to get random exceptions, in my log
files like so:

2008-07-24 16:29:26,180 [11] ERROR grizzly - doSelect exception
java.nio.channels.CancelledKeyException
    at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
    at sun.nio.ch.SelectionKeyImpl.interestOps(SelectionKeyImpl.java:59)
    at
com.sun.grizzly.TCPSelectorHandler.onReadInterest(TCPSelectorHandler.java:650)
    at com.sun.grizzly.Controller.doSelect(Controller.java:423)
    at
com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:82)
    at
com.sun.grizzly.Controller.startSelectorHandlerRunner(Controller.java:1117)
    at com.sun.grizzly.Controller.start(Controller.java:924)
    at au.com.anz.gsts.gbstp.GBSTPServer$1.run(GBSTPServer.java:90)
    at java.lang.Thread.run(Thread.java:595)

I am not sure why it happens, I was wondering if anyone else had come across
this type of thing before?

Cheers,
Mark