Broker does not always exit cleanly on Windows
ronaldsipkema opened this issue · 0 comments
I'm running the mosquitto broker on Windows in a test setup, and noticed the broker does not always exit cleanly. I tried both version 2.0.18 and 2.0.20. The problem seems to occur when the following criteria are met (at broker shutdown):
- a client with a last will defined is connected to the broker;
- a client (or bridge setup) with a subscription on this last will topic is also connected.
Where I would normally get the following to last log lines:
mosquitto version 2.0.20 terminating
Saving in-memory database to mosquitto.db.
I now (i.e., with client that has a last will and another subscriber to this last will topic) get the following:
mosquitto version 2.0.20 terminating
Sending PUBLISH to subscriber-client-id (d0, q1, r0, m9, 'last/will/topic', ... (26 bytes))
The exit code of the process (%errorlevel%) is -1073741819. It looks like the broker stops working properly while trying to send the last will messages. The interested subscriber does not receive the last will message of the other client. As a result of this bug, the persistence database is also not written to disk.
I did a quick test on Linux (Debian bookworm on WSL, mosquitto 2.0.20 from bookworm-backports), and there the problem does not exist (even though it shows some error messages in the log): the subscriber does get the last will mesagge and the persistence database is saved properly:
mosquitto version 2.0.20 terminating
Sending PUBLISH to subscriber-client-id (d0, q1, r0, m10, 'last/will/topic', ... (26 bytes))
Error in epoll re-registering to EPOLLOUT: Invalid argument
Error in epoll re-registering to EPOLLIN: Invalid argument
Saving in-memory database to mosquitto.db.