indows binary fails to persist messages even with persistence enabled
I am experiencing an issue with the official Windows binaries of Mosquitto: the broker does not persist messages or client sessions, even though persistence is enabled in the configuration file and the broker is run with administrator privileges.
Environment:
-
Linux: Ubuntu 22.04 LTS, Mosquitto installed via
apt- Persistence works perfectly
- Offline subscribers receive messages after reconnecting
-
Windows: Windows 11, Mosquitto official binaries from mosquitto.org
- Persistence does not work
- Offline subscribers do not receive messages after reconnecting
Steps to Reproduce:
- Configure persistence in Windows mosquitto.conf:
persistence true
persistence_location D:\\mosquitto\\data\\
persistence_file mosquitto.db
log_dest file D:\\mosquitto\\log\\mosquitto.log
listener 1883 0.0.0.0
allow_anonymous true
log_dest stdout
- Ensure directories exist (
D:\mosquitto\data\,D:\mosquitto\log\) and have full write permissions. - Run broker as administrator:
mosquitto.exe -c D:\\mosquitto\\mosquitto.conf
- Disconnect subscriber, publish a message while subscriber is offline:
mosquitto_pub.exe -t "test/topic" -m "hello world2" -q 2
- Reconnect subscriber — no messages are received.
Expected Behavior:
- Messages published while a subscriber is offline should be persisted and delivered after reconnect.
Actual Behavior:
- Messages are not persisted.
- Behavior differs from Linux version with the same client setup and configuration.
Notes:
- I have verified that my client supports persistent sessions and uses fixed client IDs.
- I have tried running the broker as administrator, changing directories, and using various valid configurations.
- The problem seems specific to the official Windows binary; Linux version works as expected.
Request:
Could you please check if there is an issue with persistence in the Windows binary, or provide guidance on how to enable offline message persistence on Windows?
It is always helpful to specify the version of the Mosquitto broker you are using. The broker should issues a startup message with the version to the log file. Additionally the log file would be helpful. Every creation of the persistence state on disk should issue a INFO level message in the log file. Any any error during writing the state should issue an ERROR level message in the log file.