rabbitmq / rabbitmq-mqtt

RabbitMQ MQTT plugin

Home Page:https://www.rabbitmq.com/mqtt.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AMQP connection closed while sending the Last Will message

dumbbell opened this issue · comments

When the MQTT connection is lost or closed unexpectedly, the MQTT plugin sends the Last Will message on the AMQP side and closes the AMQP connection. However, it does that asynchronously.

The Last Will message feature is tested by the java_SUITE testsuite. In the stable branch, the testcase fails rarely, but still fails. In the master branch, now that we added topic permission checks, it fails very often: it takes more time to send the Last Will message and there is a greater chance of closing the connection before.

I'm experimenting with closing the channel(s) after the Last Will message was sent, in rabbit_mqtt_process:send_will().

The testsuite is running in a loop and so far so good.

The testsuite for several hours without issues, where it took only 5-6 runs to trigger the race condition before. Therefore, I submitted the patch in #147.