Skip to content

Conversation

@ansd
Copy link
Member

@ansd ansd commented Nov 8, 2024

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 MQTT v4 client sends an async DISCONNECT
  • The global MQTT consumer metric got decremented. However, the classic queue still has the MQTT connection proc registered as consumer.
  • The test case sends a message
  • The classic queue checks out the message to the old connection instead of checking out the message to the new connection.

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

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 MQTT v4 client sends an async DISCONNECT
* The global MQTT consumer metric got decremented. However, the classic
  queue still has the MQTT connection proc registered as consumer.
* The test case sends a message
* The classic queue checks out the message to the old connection instead
  of checking out the message to the new connection.

The solution in this commit is to check the consumer count of the
classic queue before proceeding to send the message after disconnection.
@ansd ansd requested a review from dcorbacho November 8, 2024 09:42
@ansd ansd merged commit db6401d into main Nov 8, 2024
273 checks passed
@ansd ansd deleted the mqtt-flake-consumer branch November 8, 2024 10:11
ansd added a commit that referenced this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants