node-red: MQTT in Node: Error stopping node: Close timed out
What are the steps to reproduce?
Import the flow in: https://cookbook.nodered.org/mqtt/connect-to-broker, start any MQTT broker (e.g. Mosquitto) and deploy EDIT: The error is not evident with Mosquitto, as initially reported, but e.g. with https://github.com/martin-doyle/node-red-contrib-aedes.
What happens?
Every time the flow is deployed, the MQTT in node gets stuck for a while, then output: “Error stopping node: Close timed out”
What do you expect to happen?
The MQTT in node is immediately closed without errors and the flow is deployed without error and time wasting.
Please tell us about your environment:
- Node-RED version: 1.3.2
- Node.js version: 14.6.1
- npm version:
- Platform/OS: Win 10
- Browser: Chrome
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 61 (25 by maintainers)
Commits related to this issue
- Fix close timeout on MQTT nodes fixes #2934 — committed to Steve-Mcl/node-red by Steve-Mcl 2 years ago
An update for those waiting a solution.
I now understand the issue (race condition between in/out nodes closing vs broker disconnecting -AND- the MQTT lib change of when it calls the
callback
in theend()
function between client v4.2 and v4.3) and I am working on a number of angles / solutions.TBH: I rarely use full deploy so hadn’t noticed this however I suspect the issue has been present since I added Dynamic subscriptions to MQTT 4 months ago 😱
Should have an update for you today or tomorrow 🤞
2.2.2 Works great! Thanks for the quick fix
@quadhammer hopefully now you can see you are not on 2.2.2 which contains this fix. The node-red community has no control or influence on when HA release updates.
In the short term, until HA release an update, I suggest you stick to node deploys (instead of full deploys) to reduce the occurrence of this timeout.
Update: I have a working fix but I will be spending a lot more time trying various scenarios, including the aedes issue mentioned earlier in this thread before I publish. Possibly tomorrow or Friday.
In the meantime, please sit tight (or avoid full deploys if you can)
Thanks Steve, however I’d be surprised if it has been present 4 months, as I updated to node-RED v2.2.0 on 29th Jan, and this problem did not occur until I updated to v2.2.1 yesterday. Of late, I’ve been rebooting my Pi quite a lot, and am confident that I would have noticed.
sudo
is required, otherwise is fails through lack of permission But downgraded to v4.3.4, restarted and tested. Can confirm that the Error message still re-occurs.The issue still exists with Node-RED version 2. Is there any fix available?