Node-red 1.3.2 MQTT LWT regression

I upgraded a system recently to node-red 1.3.2 and have just noticed that the LWT offline message sent when node-red is shut down normally is not being sent. Strictly LWT is working, as that is the message sent when node-red terminates abnormally, and that does work, but the message sent when node-red is shut down normally is not being sent. I have now done the same with another system, I checked the message was being sent ok, upgraded from 1.2.3 to 1.3.2 and did nothing else. Now the offline message on node-red-stop is not being sent.

Both Pis, one running nodejs 14.16.1, the other 10.16.0

[Edit] I have corrected the node red version in the title and text.

Now fixed in git - will do 1.3.3 tomorrow all being well.

Before 1.3, the order we stopped flow nodes and config nodes was not necessarily intuitive - it would be possible that a config node would get stopped before flow nodes that depended on it were closed. This caused some problems with nodes that required the config node to be there in order to do some clean up in their close handling.

The logic for sending the close message from the broker node was in its close event handler.

With 1.3, we now close flow nodes before config nodes.

In the case of the MQTT nodes, by closing all the flow nodes, the broker node would realise there was no-one left using it, so it should disconnect. And that code path didn't trigger the close message, but it does now.

1 Like

Excellent, thanks Nick. I have a Pi controlling my 3D Printer with a Sonoff switch in the power to the Pi and printer. To shut it down I tell the Pi to shutdown and when the LWT indicates Offline I give it another 15 secs and then power it down via the Sonoff. That didn't work, obviously, without the LWT message.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.