-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error stopping node: Close timed out #46
Comments
Let me check. It might take some time. |
Thank you for reporting this issue. |
Additional observation. |
There is a fix for the Node-RED MQTT node in preparation. See Ensure mqtt-close message is published when closing mqtt nodes. |
Many thanks, this is really helpful. Congratulations for your excellent work! |
Unfortunately, Node-RED 1.3.3 does not fix this issue. Looking at the logs it seems that Node-RED closes the broker first and then the MQTT nodes. The MQTT nodes send a disconnect but the broker is already down. No problem with external brokers since they keep running while Node-RED shuts down. |
@martin-doyle I've created a workaround for this issue. Can I issue a PR so that you can review the change? |
Cool. Yes please do. Thanks a lot. |
I have been working on this problem in node-red core and believe I have managed to stabilise the situation somewhat. However, you might remember Nick saying the order of close events in node-red changed (so that regular nodes are signalled to close before config nodes) in node-red/node-red#2934 ? Seeing as your aedes broker node does not use the config mechanism, it can be closed before other MQTT nodes meaning sometimes (depending on position of aedes in the flow file) can prevent close message being published.. I have done a lot of testing (aedes 1st in the flow file JSON, middle of the flow file JSON, end of flow file JSON, restarting node-red, full deploy, modify aedes then partial deploy etc etc etc) and believe there is an elegant solution to resolve the close message part of this problem. If you delay the code inside Code I used in testing...
This greatly improves the situation ensuring the close message is sent etc. NOTE: this is only part of the puzzle - I will also be publishing a general overall improvement to node-red core soon. |
For those following this thread, if you have the opportunity to update to node-red 2.2.2, this problem should now be improved. The other part will require an update to this node as I described in the previous comment above. |
Hi Steve, thank you for providing this fix. Unfortunately, it did not work on my computer with Node-RED V2.2.1. |
Steps to reproduce the error
Import the flow in: https://cookbook.nodered.org/mqtt/connect-to-broker, configure Aedes node (localhost:1883) and deploy
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"
Expected behaviour
The MQTT in node would immediately close without errors and the flow would be deployed without error and time wasting, as it happens if you use an external MQTT broker (e.g., Mosquitto)
Environment
Node-RED version: 1.3.2
Node.js version: 14.6.1
The text was updated successfully, but these errors were encountered: