On Wed, Nov 27, 2024 at 01:52:50PM +0000, Laurence Tratt wrote: > On Wed, Nov 27, 2024 at 01:08:51PM +0000, Stuart Henderson wrote: > > Hello Stuart, > > >> One minor thing: I wonder if suggesting mosquitto in `pkg/DESCR` is the > >> right thing on OpenBSD? > >> > >> There is a very long-standing bug (I first experienced it a few years > >> back, and it's still present as of a week or two back) on some > >> platforms, including OpenBSD, where mosquitto uses 100% CPU when clients > >> disconnect [1]. It baffled me for ages! > >> > >> Personally, as someone experimenting with zigbee2mqtt in the last couple > >> of weeks, I switched to rabbitmq, which seems to have no such issues. > >> > >> [1] https://github.com/eclipse-mosquitto/mosquitto/issues/2807 > > Interesting, I've been running mosquitto since at least 2022 and so far > > bit's been behaving itself quite well. > > The problem seems to be solely about whether a client with id X > disconnects: if it stays connected (including reconnects), there's no > problem; if it disconnects, CPU usage can go to 100%. I've run a default > config mosquitto and seen this problem on two machines (both with low > mosquitto usage), though it took me ages to realise what the cause was! If > your clients stay connected all, or at least most, of the time, I doubt > you'd see this problem. It also seems like it might only affect BSD > platforms, though I'm not totally certain about that. > > > Laurie >
FWIW, I've been using mosquitto for at least three years, brokering messages between zigbee2mqtt, telegraf and some WiFi-based Shelly devices (power meters, metered switches, metered plugs, plain switches,...), with no problems. I have "persistent_session = false" on telegraf's MQTT client configuration, but I had no issues when this was set to true anyway. I just checked, and I can't reproduce the issue. Running mosquitto on host A, and with a telegraf client on host B, shutting down telegraf is noted by mosquitto ("Client telegraf disconnected") but has no impact on its CPU usage, everything continues as normal. The same happens when rebooting one of the metered switches (which also subscribes to MQTT): mosquitto logs the disconnection, but CPU usage remains largely unchanged. --