Channel freeze on getCloseFuture() - deadlock?
Rafael Marins
rafael.marins at neociclo.com
Tue Aug 18 16:49:50 EDT 2009
Hi Netties,
In the development of my own transport implementation for Netty a test were
created as the code bellow. There are very few circumstances where the
execution simply freeze on channelFuture.getChannel().close() instruction -
it's random. Most of times I run it and get it all okay, but sometimes it
breaks and I must have to stop the execution manually.
@Test
public void testChannelConnectAndDisconnect() throws Exception {
...
ClientBootstrap bootstrap = ...
// CONNECT
ChannelFuture channelFuture = client.connect(calledAddress,
callingAddress);
channelFuture.await();
// DISCONNECT
ChannelFuture closeFuture = channelFuture.getChannel().close();
closeFuture.await();
}
After a deep analysis & debugging I found that the execution freezes when
the framework try to call the AbstractChannel.getCloseFuture() method. It's
invoked from within the Channels.close() method.
When it happens the last logging entry shown is a WRITE_COMPLETE event being
handled by the ChannelSink, then it freezes. I believe that there has such a
deadlock for handling CLOSE_REQUEST concurrently with the WRITE_COMPLETE.
If a Thread.sleep(10) is introduced between the CONNECT and DISCONNECT,
everything goes fine on every execution.
Any clue?
Best regards,
-----
Rafael Marins
Neociclo - http://www.neociclo.com
--
View this message in context: http://n2.nabble.com/Channel-freeze-on-getCloseFuture%28%29---deadlock--tp3468527p3468527.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list