Unacked messages are not redelivered #11229
Replies: 7 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
We need an executable way to reproduce. You haven't provided any evidence that automatic requeueing does not happen, and we haven't see anyone report this earlier. In fact, I cannot reproduce this behavior when I terminate a few connections with consumed and unacknowledged messages. Connections going away is [detected after a period of time](https://www.rabbitmq.com/docs/heartbeats, so that can be a factor. But a more likely scenario is this:
In fact, the consumer on step 3 can be the same consumer if it reconnects before or concurrently with the auto-requeueing step performed by the server. |
Beta Was this translation helpful? Give feedback.
-
You haven't provided any evidence of that connection being closed. According to the log snippet shared, it was successfully accepted and that's it. In 99.9% of cases such behavior is an indication of a stuck consumer. Double checking error handling and exception reporting in your consumer code is where I'd start producing an executable way for us to reproduce. And please share logs as files with sensitive data obfuscated, not as screenshots. |
Beta Was this translation helpful? Give feedback.
-
Prefetch cannot be set for a queue, it can be set for a channel or for a consumer (the latter is a fairly rare thing to see).
An explanation can be as simple as: there are multiple consumers on a channel and these "stuck" messages were instantly redelivered to another consumer on another channel. Again, we do not guess in this community so without an executable way to reproduce, above is a number of hypothesis for you to investigate. |
Beta Was this translation helpful? Give feedback.
-
Finally, one very easy way to verify if this queue is "special" in any way is to
To further confirm 3 and every hypothesis above, a traffic capture will tell you exactly what RabbitMQ and connected clients send and receive. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the fast response! The connection from the first screenshot was definitely closed: Since there is only one application consuming these queues, I cannot think that it is a requeuing problem. In code we attached to all exception & error events, and nothing occurred. I will dig into it with all your provided steps. |
Beta Was this translation helpful? Give feedback.
-
@michaelklishin I guess I have found the problem. Some of our quorum queues do not have all members online, and when a consumer opens a connection to a node that does not have that queue, the problems described occur. In the logs two weeks ago I found now some information about corrupt segment files related to these sometimes misleadingly acting queues, and also some crashes with the reason 'reached_max_restart_intensity'. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When we re-start our .net 7 application using the rabbitmq.client package, at least one queue gets stuck with unacked messages.
We have a debug log implemented as first step after the consumer received a message (e.g. Consumer received message 1928618 with deliveryTag 1191 for queue X.), and see that for this stuck queue we never received any message after the restart, although according to the rabbitmq web managment 20 messages are unacked (the prefetch count is set to 20 per queue).
What looks strange that in the overview of the queue there are 20 unacked messages, but the consumer channel has 0 messages unacknowledged.
All other queue consumers on this consumer connection are working fine with related log messages.
We have 2 .net 7 applications, one is only producing messages over one producer connection and one is producing messages over one producer connection and consuming messages over one consumer connection, by 1 consumer per queue for total 149 queues.
With publisher confirms and manual acks every 10 messages.
Reproduction steps
Expected behavior
We expect that the messages will be returned to the server if the consumer is disconnected.
Additional context
RabbitMQ -v 3.13.1
Erlang -v 26.2.2
RabbitMQ.Client -v 6.5.0
Mirror: quorum (3 nodes)
Beta Was this translation helpful? Give feedback.
All reactions