RabbitMQ - 升级到新版本并收到大量“PRECONDITION_FAILED Unknown Delivery Tag 1”信息
刚刚升级到 RabbitMQ 的新版本 - 2.3.1 - 现在出现以下错误:
PRECONDITION_FAILED unknown delivery tag 1
...随后通道关闭。这适用于较旧的 RabbitMQ,无需进行客户端更改。
就应用程序行为而言:
当应用程序 A 想要向应用程序 b 发送异步消息并接收来自 B 的答复时,算法如下:
- 应用程序 A 生成唯一 ID 并将其放入消息对象中
- 然后应用程序 A 订阅新的消息队列名称和路由键都等于 uuid 的队列。
- App B 打开消息,进行一些计算,然后使用收到的 routekey 将结果返回到通道。
- 应用程序 A 获得答案并关闭队列。
到目前为止,1.7.0 中一切都进展顺利。 2.3.1 出了什么问题?
当应用程序 A 调用 basicPublish()
时,应用程序 B 立即抛出以下异常:
com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406,reply-text=PRECONDITION_FAILED - unknown delivery tag 1,class-id=60,method-id=80),null,""}
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:191)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:159)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:438)
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406,reply-text=PRECONDITION_FAILED - unknown delivery tag 1,class-id=60,method-id=80),null,""}
Just upgraded to a new version of RabbitMQ -- 2.3.1 -- and now the following error occurs:
PRECONDITION_FAILED unknown delivery tag 1
...followed by the channel closing. This worked on an older RabbitMQ with no client-side changes.
In terms of application behavior:
When App A wants to send an async message to App b and receive an answer from B, this is the algorithm:
- App A generate a unique ID and puts it in the message object
- Then App A subscribes to a new Queue with both the queue name and routing key equals to the uuid.
- App B open the message, do some calculations and return the result to the channel with the routkey that it recieved.
- App A gets the answer and close the queue.
So far everything went really well in 1.7.0. what went wrong in 2.3.1?
When Application A calls basicPublish()
, application B immediately throws the following exception:
com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406,reply-text=PRECONDITION_FAILED - unknown delivery tag 1,class-id=60,method-id=80),null,""}
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:191)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:159)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:438)
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406,reply-text=PRECONDITION_FAILED - unknown delivery tag 1,class-id=60,method-id=80),null,""}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能导致该异常的唯一代码路径是通过代理处理“basic.ack”,因此这听起来像是客户端问题;检查客户端代码。
特别是,请检查您是否多次确认消息。这样做违反了 AMQP 0-9-1 规范:
提出此类问题的好地方是rabbitmq-discuss mainling-list;所有 RabbitMQ 开发人员都阅读了该列表,并强调不要留下未解答的问题。
还值得注意的是,以前版本的 Rabbit 比较宽松,在这种情况下不会抛出错误,但较新的版本会抛出错误。
The only codepath that can cause that exception is through the broker handling a 'basic.ack', so this sounds like a client issue; check the client code.
In particular, check that you aren't ack'ing messages more than once. Doing so is in violation of the AMQP 0-9-1 spec:
A great place to ask such questions is the rabbitmq-discuss mainling-list; all the RabbitMQ developers read that list and make a point of not leaving questions unanswered.
It's also worth noting that previous versions of Rabbit were more lax and did not throw an error in this case, but more recent versions do.
只需在
BasicConsume
方法上设置noAck: false
Just set
noAck: false
onBasicConsume
method