protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown del...

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 18 - 后面的忘了

INFO | jvm 1 | 2017/02/23 14:28:43 | at java.lang.Thread.run(Thread.java:745)
INFO | jvm 1 | 2017/02/23 14:28:43 | Exception in thread "LDService-Worker-3" com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 2, class-id=60, method-id=80)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:195)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.AMQChannel.transmit(AMQChannel.java:309)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:657)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:640)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:631)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicPublish(AutorecoveringChannel.java:168)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.ld.net.remoting.rmq.XXX$DealRequest.processRequest(XXX.java:567)
INFO | jvm 1 | 2017/02/23 14:28:43 | at com.ld.net.remoting.rmq.XXX$3$1.run(XXX.java:208)
INFO | jvm 1 | 2017/02/23 14:28:43 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
INFO | jvm 1 | 2017/02/23 14:28:43 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

原因:经多次重复测试,应该是客户端double ack的原因。

如果启用了批量ack的,将channel.basicAck(envelope.getDeliveryTag(), true); 改为channel.basicAck(envelope.getDeliveryTag(), false);

否则,检查下是否在basicConsume的时候设置了autoAck,同时业务代码里面又调用了channel.basicAck。

除此之外,还可能有下列错误:

com.rabbitmq.client.ShutdownSignalException: clean channel shutdown; protocol method: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)

INFO | jvm 1 | 2017/02/24 10:28:59 | 17-02-24 10:28:58 ERROR CF-TP-37  XXX$3.handleDelivery(XXX.java:226): 处理消息的时候发生异常,会导致channel关闭,需要重启
INFO | jvm 1 | 2017/02/24 10:28:59 | java.util.concurrent.RejectedExecutionException: Task XXXX.$3$1@722bfd74 rejected from java.util.concurrent.ThreadPoolExecutor@33b8fcd1[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 476]
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047)
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369)
INFO | jvm 1 | 2017/02/24 10:28:59 | at XXX.$3.handleDelivery(LDMultiServiceBeanConfigurer.java:205)
INFO | jvm 1 | 2017/02/24 10:28:59 | at com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:144)
INFO | jvm 1 | 2017/02/24 10:28:59 | at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:99)
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
INFO | jvm 1 | 2017/02/24 10:28:59 | at java.lang.Thread.run(Thread.java:745)

这不一定是MQ自身的问题,有可能是客户端有其他的非MQ相关的异常没有被捕获导致线程抛出异常,进而导致相关MQ消费者线程也异常,详细看日志。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值