Channel freeze on getCloseFuture()deadlock?

"이희승 (Trustin Lee)" trustin at gmail.com
Thu Aug 20 03:48:43 EDT 2009


Hi Rafael,

Do you have any full thread dump?  We did not experience such a dead
lock in the existing transports.  Perhaps you are synchronizing over
some object that Netty uses for synchronization?

HTH,
Trustin

On 08/19/2009 05:49 AM, Rafael Marins wrote:
> 
> 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
> 
> 



More information about the netty-users mailing list