eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.61k stars 2.33k forks source link

Starting mosquitto broker as Windows Service fails if interface doesn't yet exist on boot, ignores failure to open persistence file, etc. #3047

Open pjkundert opened 1 month ago

pjkundert commented 1 month ago

When starting as a Windows Service (on reboot, after "mosquitto install"), there are several issues that prevent it from starting, operating and stopping reliably.

0) If a persistence_filepath cannot be opened -- the service simply ignores this failure and does not even log a warning or produce any other error message: it is considered a "success"!

** This is a SERIOUS* defect!! See line 431 of persist_read.c:

https://github.com/eclipse/mosquitto/blob/15292b20b0894ec7c5c3d47e4b22ee9d89f91132/src/persist_read.c#L431

1) If the listen interface doesn't yet exist with the specified IP address (eg. a ZeroTier interface which has not yet come up), then the "mosquitto" Windows Service simply fails to start.

If a simple C:\mosquitto.log file is specified, the following error is produced: Error: The requested address is not valid in its context.

However, if the target listen interface does exist, then it can appear and disappear as it wishes, and the mosquitto service continues to operate, reconnecting as necessary.

*** If an interface cannot be opened at start-time, it should be attempted later. As long as one interface is open, the service should start.

2) On manually stopping the service, an "Error 1067: The process terminated unexpectedly" error pop-up is always displayed.