mosquitto icon indicating copy to clipboard operation
mosquitto copied to clipboard

indows binary fails to persist messages even with persistence enabled

Open Mq-b opened this issue 1 month ago • 1 comments

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:

  1. 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
  1. Ensure directories exist (D:\mosquitto\data\, D:\mosquitto\log\) and have full write permissions.
  2. Run broker as administrator:
mosquitto.exe -c D:\\mosquitto\\mosquitto.conf
  1. Disconnect subscriber, publish a message while subscriber is offline:
mosquitto_pub.exe -t "test/topic" -m "hello world2" -q 2
  1. 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?

Mq-b avatar Nov 25 '25 16:11 Mq-b

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.

NorbertHeusser avatar Dec 01 '25 18:12 NorbertHeusser