Closed TCP Channel (Netty 3.1.1GA)
Thomas Bocek
bocek at ifi.uzh.ch
Thu Aug 20 14:08:24 EDT 2009
Hi,
I'm having the following issue that once a while I get an exception due
to a ClosedChannelException. I made a test and this happens once per
every 10'000 connections or so and its very undeterministic. In the test
I open locally a connection, send data, wait for a reply, and close it.
Most of the time opening connection works, but in rare occasions it does
not.
The exception gets set in:
NioWorker, 731:
if (localAddress == null || remoteAddress == null) {
if (future != null) {
future.setFailure(new ClosedChannelException());
}
close(channel, succeededFuture(channel));
return;
}
Here, localAddress is null, and remoteAddress is null. Before the future
is set, as far as I can see, NioClientSocketPipelineSink in line 146
calls register(...):
if (channel.socket.connect(remoteAddress)) {
channel.worker.register(channel, future);
} else {
future.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
channel.connectFuture = future;
boss.register(channel);
}
The socket in the NioClientSocketChannel class says: bound=false,
closed=false, connected=false, created=false, and the selector is open
so I expect that boss.register(...) is called.
Here is the stacktrace:
Thread [New I/O client worker #1-2] (Suspended (breakpoint at line 299
in DefaultChannelFuture))
DefaultChannelFuture.setFailure(Throwable) line: 299
NioWorker$RegisterTask.run() line: 731
NioWorker.processRegisterTaskQueue() line: 260
NioWorker.run() line: 199
ThreadRenamingRunnable.run() line: 113
IoWorkerRunnable.run() line: 53
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
Thread.run() line: 619
How and when is it safe to assume that a channel is connected and has a
local and remote address set?
I'm not sure if there is a mistake in my code (more likely) or in Netty.
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20090820/dbe110fa/attachment.bin
More information about the netty-users
mailing list