rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.31k stars 3.92k forks source link

Fix MQTT test flake #12687

Closed ansd closed 2 weeks ago

ansd commented 2 weeks ago

Prior to this commit, test

make -C deps/rabbitmq_mqtt ct-mqtt_shared t=[mqtt,cluster_size_1,v4]:non_clean_sess_reconnect_qos0_and_qos1

flaked in CI with error:

{mqtt_shared_SUITE,non_clean_sess_reconnect_qos0_and_qos1,972}
{badmatch,{publish_not_received,<<"msg-0">>}}

The problem was the following race condition:

The solution in this commit is to check the consumer count of the classic queue before proceeding to send the message after disconnection.