Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

项目启动时报死锁io.netty.util.concurrent.BlockingOperationException: AbstractChannel$CloseFuture@5a74c9ec(incomplete) #10

Open
qingshuhu opened this issue Sep 14, 2017 · 7 comments

Comments

@qingshuhu
Copy link

An exception was thrown by com.newlandframework.rpc.netty.MessageRecvExecutor$2.operationComplete()
io.netty.util.concurrent.BlockingOperationException: AbstractChannel$CloseFuture@12f3c0d1(incomplete)
at io.netty.util.concurrent.DefaultPromise.checkDeadLock(DefaultPromise.java:391) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.DefaultChannelPromise.checkDeadLock(DefaultChannelPromise.java:157) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.DefaultPromise.await(DefaultPromise.java:252) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.DefaultChannelPromise.await(DefaultChannelPromise.java:129) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.DefaultChannelPromise.await(DefaultChannelPromise.java:28) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.DefaultPromise.sync(DefaultPromise.java:219) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.DefaultChannelPromise.sync(DefaultChannelPromise.java:117) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.DefaultChannelPromise.sync(DefaultChannelPromise.java:28) ~[netty-all-4.0.36.Final.jar:4.0.36.Final]
at com.newlandframework.rpc.netty.MessageRecvExecutor$2.operationComplete(MessageRecvExecutor.java:144) ~[classes/:?]
at com.newlandframework.rpc.netty.MessageRecvExecutor$2.operationComplete(MessageRecvExecutor.java:135) ~[classes/:?]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:683) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.DefaultPromise$LateListeners.run(DefaultPromise.java:854) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.DefaultPromise$LateListenerNotifier.run(DefaultPromise.java:882) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:374) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.36.Final.jar:4.0.36.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
[id: 0x891ad835] REGISTERED
[id: 0x891ad835] BIND(0.0.0.0/0.0.0.0:18886)
You can open your web browser see NettyRPC server api interface: http://127.0.0.1:18886/NettyRPC.html
[id: 0x891ad835, L:/0:0:0:0:0:0:0:0:18886] ACTIVE
Disconnected from the target VM, address: '127.0.0.1:51430', transport: 'socket'

@tang-jie
Copy link
Owner

之前的服务有没有停干净?18886端口有没有被占用?

@helloktz
Copy link

helloktz commented Nov 2, 2017

不能在同一个线程中调用sync方法,会触发NioEventLoop的死锁检查。 此处sync()方法实际会执行失败。
可以在operationComplete方法结尾尝试System.out.println标志来验证。

@yiwuwang
Copy link

请问如何解决这个异常,(虽然即使有这个异常,程序也能正常运行)

@helloktz
Copy link

去掉sync(),: channelFuture.channel().closeFuture().addListener(...

@yiwuwang
Copy link

@helloktz 哦,谢谢

@wxz1211
Copy link

wxz1211 commented Dec 21, 2017

可以不用channelFuture.channel().closeFuture().addListener这种方式 ,
把netty服务端和http协议都改成线程模型,sync不用去掉

@gccdChen
Copy link

可以不用channelFuture.channel().closeFuture().addListener这种方式 ,
把netty服务端和http协议都改成线程模型,sync不用去掉

怎么改成线程模型?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants