rabbitmq-server
rabbitmq-server copied to clipboard
Management UI reports two consumers as active on a QQ with x-single-active-consumer
Describe the bug
Rabbit MQ Version: 4.0.5
When using RabbitMQ's x-single-active-consumer feature, the management UI shows all connected consumers with the status "single active" under the Activity status column. However, this is misleading because only one consumer is actually active and receiving messages, while the others are in a standby state, waiting to take over if the active consumer disconnects or fails.
This behavior is intentional and works as designed for the x-single-active-consumer feature, ensuring only one active consumer processes messages at a time. However, the UI does not differentiate between the active consumer and the standby consumers, which can cause confusion for users.
Reproduction steps
1.Run the following command to publish 5000 messages to a quorum queue named qq-sac with the x-single-active-consumer feature enabled: java -jar perf-test.jar --uri amqp://guest:[email protected]:5672 --quorum-queue --queue qq-sac --pmessages 5000 --confirm 100 -qa x-single-active-consumer=true --consumers 0 Start a consumer with default priority (prefetch 1000, consumption rate ~10 msgs/sec):
2.Start a consumer with default priority and a prefetch count of 1000: java -jar perf-test.jar --uri amqp://guest:[email protected]:5672 --producers 0 --predeclared --queue qq-sac --consumer-latency 100000 --qos 1000 Start a second consumer with higher priority:
3.Start another consumer on the same queue, but with a higher priority (x-priority=10): java -jar perf-test.jar --uri amqp://guest:[email protected]:5672 --producers 0 --predeclared --queue qq-sac --consumer-latency 100000 --qos 1000 --consumer-args x-priority=10 Observation:
4.In RabbitMQ's management UI, both consumers will be displayed as having the "single active" status under Activity status, even though only one consumer is actively consuming messages, while the other is in standby mode. This leads to confusion as the UI does not differentiate the active consumer from the standby consumers.
Expected behavior
The UI should clearly indicate which consumer is active and which ones are in a standby state when the x-single-active-consumer feature is enabled.
Additional context
No response
I'm pretty sure I have seen it work as expected a month or two ago (I do not need to use SAC very often to develop RabbitMQ itself).
Thank you for the steps to reproduce with PerfTest, we'll try to reproduce.
I'm pretty sure I have seen it work as expected a month or two ago (I do not need to use SAC very often to develop RabbitMQ itself).
Thank you for the steps to reproduce with PerfTest, we'll try to reproduce.
Thank you for looking into this! I appreciate your help.If you need any additional details, feel free to ask. I'm happy to assist.
https://github.com/rabbitmq/rabbitmq-server/pull/13063
4.1.0-alpha.a9e972f5 includes #13063, a 4.0.x alpha build will follow later today under Releases in the same repo, rabbitmq/server-packages.
#13063 is not the same as this issue. I have recovered it in [4.1.0-alpha.a9e972f5], but the problem still persists. The two consumers remain in the single active state, and the status shown in the management UI does not match the command line results.
@zachary-jiang then we need an executable way to reproduce, with PerfTest, Stream PerfTest or a small application.
Issue Reproduction Using Perf-Test
I used perf-test to reproduce this issue. Below are the detailed steps:
1. Publish 5000 Messages to a Quorum Queue Named qq-sac with x-single-active-consumer Enabled
Run the following command to publish 5000 messages:
java -jar perf-test.jar --uri amqp://{{username}}:{{passwd}}@{{mqhost}}:{{port}} --quorum-queue --queue qq-sac --pmessages 5000 --confirm 100 -qa x-single-active-consumer=true --consumers 0
2. Start Consumer A with Priority 5, Prefetch Count of 640, and Consumer Latency of 10000 ms
Run the following command to start Consumer A:
java -jar perf-test.jar --uri amqp://{{username}}:{{passwd}}@{{mqhost}}:{{port}} --producers 0 --predeclared --queue qq-sac --consumer-latency 10000 --qos 640 --consumer-args x-priority=5
3. Start Consumer B with Higher Priority (x-priority=10)
Run the following command to start Consumer B:
java -jar perf-test.jar --uri amqp://{{username}}:{{passwd}}@{{mqhost}}:{{port}} --producers 0 --predeclared --queue qq-sac --consumer-latency 1000 --qos 1000 --consumer-args x-priority=10
Behavior Observation
-
Consumer A consumes messages at a rate of 64 messages/second.
-
With a prefetch count of 640, it takes approximately 10 seconds for Consumer A to process all prefetched messages.
-
When Consumer B starts, it will begin receiving messages after Consumer A finishes consuming its prefetched messages (after 10 seconds).
-
When Consumer B starts receiving messages, refresh the queue UI. You will see both Consumer A and Consumer B listed as
single-activein the Activity Status column under the Consumers properties.
Placeholder Explanation
-
Replace
{{username}}and{{passwd}}with the actual RabbitMQ username and password. -
Replace
{{mqhost}}and{{port}}with the RabbitMQ host address and port.
It's only displayed wrongly in the management UI. Only one consumer is actually active at any given time. Function consumer_update_active_effects/5 in rabbit_fifo needs to be called for the low prio consumer when the high prio consumer takes over.
It is now fixed in future 4.2.x and in next 4.1.x.
It is now fixed in future 4.2.x and in next 4.1.x. Got it, thanks for fixing it! I’ll keep an eye on the next 4.1.x / 4.2.x release.