closefuture.sync() deadlock?

415 views
Skip to first unread message

Xiao Li

unread,
Jul 3, 2013, 8:44:44 AM7/3/13
to ne...@googlegroups.com
Hi,

  I am trying to find a way to close rxtx channel. After running the non-modified netty rxtx example code, I found below line will never finish:

        f.channel().closeFuture().sync();

  The environment is Netty 4.0.0CR9, with RXTX 2.2, on Windows 7.
  It is problem also seen on anybody's computer so it is a issue? Or maybe there is some workaround for it?
  Any help is appreciated! Thanks!

Regards
-Shawn

Hack Kampbjørn

unread,
Jul 3, 2013, 9:16:46 AM7/3/13
to ne...@googlegroups.com
That line doesn't close the connection, it just waits until something else calls close and that operation finishes.

Look at RxtxClientHandler for where the connection is supposed to be closed in the that example.

As you are on windows you probably need to adjust /dev/ttyUSB0 to whatever com port you want to talk to.

/Hack

--
 
---
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Xiao Li

unread,
Jul 3, 2013, 10:36:26 PM7/3/13
to ne...@googlegroups.com, ha...@kampbjorn.com
  Thank you very much Hack,
  You are right, It was the case that I didn't invoke ctx.close().
  Then based on the same code, I commented out ctx.close() and tried to close channel out side of channel handler, with following lines.
            ChannelFuture f = b.connect(new RxtxDeviceAddress("COM11")).sync();
            Thread.sleep(3000);
            f.channel().close();

  Then will get an exception:

java.lang.NullPointerException
    at io.netty.channel.oio.OioByteStreamChannel.available(OioByteStreamChannel.java:77)
    at io.netty.channel.oio.OioByteStreamChannel.doReadBytes(OioByteStreamChannel.java:85)
    at io.netty.channel.oio.AbstractOioByteChannel.doRead(AbstractOioByteChannel.java:85)
    at io.netty.channel.oio.AbstractOioChannel$1.run(AbstractOioChannel.java:40)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:324)
    at io.netty.channel.ThreadPerChannelEventLoop.run(ThreadPerChannelEventLoop.java:69)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Unknown Source)

Did I missed anything in this case?

Thanks a lot!
-Shawn

"이희승 (Trustin Lee)"

unread,
Jul 3, 2013, 11:02:47 PM7/3/13
to ne...@googlegroups.com
Looks like a bug: https://github.com/netty/netty/issues/1514
> On 2013-07-03, at 14:44, Xiao Li <xiao...@gmail.com <javascript:>>
> wrote:
>
>> Hi,
>>
>> I am trying to find a way to close rxtx channel. After running
>> the non-modified netty rxtx example code, I found below line will
>> never finish:
>>
>> f.channel().closeFuture().sync();
>>
>> The environment is Netty 4.0.0CR9, with RXTX 2.2, on Windows 7.
>> It is problem also seen on anybody's computer so it is a issue?
>> Or maybe there is some workaround for it?
>> Any help is appreciated! Thanks!
>>
>> Regards
>> -Shawn
>>
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the
>> Google Groups "Netty discussions" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to netty+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out
>> <https://groups.google.com/groups/opt_out>.
>>
>>
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to netty+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
https://twitter.com/trustin
https://twitter.com/trustin_ko
https://twitter.com/netty_project
Reply all
Reply to author
Forward
0 new messages