Hi,
first of all, I would like to say that Grizzly2 looks great :)
(API looks much simpler).
Could I knowwhen the 2.0 release is planned?
I dont know is it worth to wait for it...
(or write code using 1.9.9)
Additionally I have found following problems in code:
(figured that I post them here - Im not sure if this was good assumption
:) )
1.
I was trying to write simple packet forwarder in grizzly2 using FilterChain.
I have encountered following code in
FilterAdapter.postExecute(FilterChainContext ctx, NextAction nextAction):
(...)
case CONNECTED :
return postWrite(ctx, nextAction);
(...)
I think this could be a typo (instead I think, there should be
postConnect() - method is even in that file, but not used).
To 'handle' this case, right now in my custom filter, in method
postWrite() I have to use:
if (ioEvent != IOEvent.CONNECTED).
2.
Second problem occurs when there is an abnormal client connection
termination, while server is using TCPNIOTransportFilter.
After closing, READ event on server is called, this leads to following
code execution:
Near line 100:
TCPNIOTransportFilter.handleRead()
buffer.clear();
connection.readNow0(buffer, null);
if (buffer.position() > 0) {
buffer.flip();
ctx.setMessage(buffer);
} else {
buffer.position(buffer.limit());
connection.close();
return new StopAction();
}
readNow0() throws IOException, that bypasses connection.close().
And then another GrizzlyWorker tries to read from this closed
connection, and the story repeats itself - this causes 100% CPU usage.
Right now I have to add:
try {
connection.readNow0(buffer, null);
} catch (IOException e) {
buffer.position(buffer.limit());
connection.close();
return new StopAction();
}
Yours sincerely,
Mikolaj Grajek