Repository navigation
notify_consumer: a cancelled consumer's later delivery timeout closes the channel with 406 #18207
Replies: 3 comments 2 replies
|
Note Written by Claude Code under the direction of @lukebakken. A late acknowledgement does not close the channel. One delivery on a quorum queue, 2 s consumer timeout,
So the channel already remembers the tags it reclaimed for a timed-out consumer and ignores late acks and nacks for them. That makes the 406 in the original report look more like an oversight: the same channel knows the consumer was cancelled for a timeout when it handles a late ack, but not when a remaining delivery times out. |
|
A fix is up as a draft PR: #18255. Testing consumers that hold many deliveries found four more defects in the same path, all present on |
|
I designed and wrote this feature and even after reading this discussion twice I understand very little. The code in #18255 looks way over the top for such a small issue. Perhaps it is better just to hard close the whole channel at all times for for the legacy protocol? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Note
Written by Claude Code under the direction of @lukebakken.
RabbitMQ version used
4.4.0 (the same code is on
main)Erlang version used
29.1.2
Operating system and deployment
Community Docker image
rabbitmq:4.4-managementWhat happens
With
consumer_timeout_response = notify_consumer(the default), a consumer on a quorum queue that holds two unacknowledged deliveries getsbasic.cancelwhen the first one times out. The cancellation returns only that delivery. The second stays on the channel, and when it times out after the consumer has been removed, the channel is closed with 406PRECONDITION_FAILED, whichnotify_consumeris meant to prevent.The client cannot avoid it. Answering
basic.cancel-ok, asaccept_consumer_cancel_okinvites and as the Java, .NET and Go clients (and pika from 1.5.0) do, removes the consumer at once, so any later timeout closes the channel. Not answering keeps the consumer cancel-pending for 10 s, which hides timeouts inside that window but not later ones.Reproducer, which runs in a minute against a fresh container: https://github.com/lukebakken/rabbitmq-consumer-timeout-cancel-ok
--cancel-ok: channel closed with 406, 10 of 10 runs.--no-cancel-ok: channel stays open, 10 of 10 runs.--no-cancel-ok --timeout-ms 20000 --gap 15: channel closed with 406 once the window has passed, 2 of 2 runs.Question
In
rabbit_channel.erl, once the consumer is out of the consumer map,handle_consumer_delivery_timeoutfalls back tohandle_consumer_timed_outfor its remaining deliveries. Should a delivery from a consumer already cancelled for a timeout be covered by that cancellation instead of closing the channel?All reactions