[Questions] When exactly triggers a consumer acknowledge timeout? #12446
-
Hi, I'm seeing a delivery acknowledgement timeout on a server every couple of days and have not been able to manually reproduce such a timeout with an intentionally blocked consumer. Therefore my question is, what exactly triggers the timeout (if not a sleeping consumer like in the code below)? Please see the following RabbitMQ screenshot:
Community Support Policy
RabbitMQ version used4.0.2 Erlang version used26.2.x Operating system (distribution) usedUbuntu 24 How is RabbitMQ deployed?Community Docker image rabbitmq-diagnostics status outputLogs from node 1 (with sensitive values edited out)(Note: The timeout here is the production timeout of 1800000ms, the screenshot above however shows the local setup of my unsuccessful try to reproduce the error with a shorter timeout)
Logs from node 2 (if applicable, with sensitive values edited out)No response Logs from node 3 (if applicable, with sensitive values edited out)No response rabbitmq.conf
Steps to deploy RabbitMQ clusterdocker run Commands Steps to reproduce the behavior in questionCurrently I'm not aware of a way to manually reproduce the timeout, however the timeout is encountered every couple of days for a long-running application instance. advanced.configNo response Application code@RabbitListener(
queues = "#{userQueue.name}",
id = "liveSyncQueue",
autoStartup = "false",
exclusive = true,
ackMode = "MANUAL") // <---- manual ack mode
public class RabbitController {
@RabbitHandler
public void receiveUserSyncMessage(
Channel channel,
@Header(AmqpHeaders.DELIVERY_TAG) long tag,
@Payload UserMessageBody userMessageBody
) throws IOException {
try {
log.info("Sleep after user message");
Thread.sleep(10 * 60 * 1000); // 10 min sleep
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// processing code
channel.basicAck(tag, false); // manual ack
}
} Kubernetes deployment fileNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
First of all, it's important to keep in mind that this timeout is not accurate. In fact, we know it usually takes 1 minute more than the configured value to trigger the timeout. We haven't fixed that because it's not important - this timeout is just a safety precaution to prevent broken consumers hanging for a very long time, so 1 minute doesn't make a difference. Having said that, for you it's not about just 1 additional minute. I just tried with https://perftest.rabbitmq.com/ and everything works as expected (with the +1 minute caveat). If I run this:
2 minutes later I see the consumer timeout logged. Does it work for you with perf-test? |
Beta Was this translation helpful? Give feedback.
-
@lukaseckert the relevant doc section has an answer:
Here is where it happens in the code. There's nothing particularly creative there, it's just a timer which is not perfectly precise but for what this feature does, it is perfectly fine. |
Beta Was this translation helpful? Give feedback.
-
Hi @mkuratczyk and @michaelklishin While is is completely my mistake, may I suggest to add a note in the docs that any non-integer value for the I think this is especially important because from the management UI, there is no way to see the difference:
|
Beta Was this translation helpful? Give feedback.
@lukaseckert the relevant doc section has an answer:
Here is where it happens in the code. There's nothing particularly creative there, it's just a timer which is not perfectly precise but for what this feature does, it is perfectly fine.