Skip to content

Handle exception in NIO loop to avoid abrupt termination #611

Closed
@hailin84

Description

@hailin84

rabbitmq-nio thread terminated unexpectedly

I am using rabbitmq in my java system. When I try to use nio, I got rabbitmq-nio thread terminated unexpectedly. I review the code, there must be two problems(NioLoop.run):

  • NIO epoll bug, not handled;
  • exception should be caught in the main while loop, that's why rabbitmq-nio thread terminated unexpectedly. SocketChannel to rabbitmq server may be closed, but nio selector thread should not exit.

Here is my exception stacktrace log:

2019-05-15 14:37:28.379 ERROR [rabbitmq-nio] nio.NioLoop(NioLoop.run:254) - Error in NIO loop
java.nio.channels.ClosedChannelException
    at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:197) ~[?:1.8.0_181]
    at com.rabbitmq.client.impl.nio.NioLoop.run(NioLoop.java:118) ~[amqp-client-5.5.1.jar:5.5.1]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

Thanks for your help.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions