Open luisfdo85 opened 2 years ago
@luisfdo85 can you share more details on your setup? It seems the connection is closed at a certain time and then the node fails. So, need to take a deeper look into the cause.
We have +30 flows, each flow is associated with one equipment, and the configuration of each flow is gathering field equipment data using Modbus or SNMP protocols and publishing it as MQTT to IoTHub using the node "azureiotdevice". Each flow has between 2 to 5 "azureiotdevice" nodes.
To reduce the published traffic, we scan the field data every 30s, and if there is no change, then we don't publish anything. To keep the connection alive, we publish all the points every 1 hour. Since we have several flows, we created delays between each trigger in the flows (1 minute) to avoid the issue of trying to publish all at once. I am attaching an example of one of the flows and the configuration of one of the "azureiotdevice" nodes.
Please let me know if you have any other questions or specific information you would like to see.
Thanks
@luisfdo85 your setup looks fine. You can have mutiple azureiotdevice nodes on one page. The enrollmenttype is ignored because you use constr as connectiontype. The retry is default and fine. What might be interesting to look at is the number of messages you send per time interval. Is your IoT hub configured large enough to ensure you don't hit any thresholds: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-quotas-throttling. The node should still not fail, so I will look into that. But it could be why IoT Hub is "disconnecting". BTW what version of the node are you using? 2.5 is the latest.
The Azure IoTHub is Standard Tier S1. The node version is 2.5. There is something that is failing related to the "device twin" desire properties. Every time the node-red container fails is related to the same type of message for the "device twin". What configuration should we have in the "device twin" in Azure?
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Listening to C2D messages,
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Device client connected.,
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Retrieve device twin.,
1 Aug 20:43:11 - [error] [azureiotdevice:f884d74e.f041d8] GA28205-E -> Device Client disconnected.,
1 Aug 20:43:11 - [info] [azureiotdevice:f884d74e.f041d8] GA28205-E -> Closing all clients.,
1 Aug 20:43:11 - [info] [azureiotdevice:f884d74e.f041d8] GA28205-E -> Initiate IoT Device settings.,
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Device twin created.,
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Twin contents: {"reported":{"$version":1},"desired":{"$version":1}},
1 Aug 20:43:11 - [info] [azureiotdevice:c6d47b12.bd92b8] GA28205-E -> Desired properties received: {"$version":1},
1 Aug 20:43:11 - [red] Uncaught Exception:,
1 Aug 20:43:11 - Error: Connection closed,
at /data/node_modules/mqtt/lib/client.js:124:29,
at Array.forEach (node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
,
npm ERR! Exit status 1,,
,
npm ERR! Failed at the node-red-docker@1.1.2 start script.,
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.,
Hello @iotblackbelt, do you have any updates? Please let me know if you need additional information. Thanks
The error thrown in flushVolatile (line 206 in version 4.3.7 of mqtt) will make Node-RED crash, as it is uncaught. Where can this error be caught? Proper error handling would be needed to keep the system running when there is a varying connection, and also to be able to store messages during connection downtime.
Hello and happy new year to everybody on this chat. Question for mochr : When you say: "The error thrown in flushVolatile (line 206 in version 4.3.7 of mqtt) " Please provide more information. Is "FlushVolatile" part of which code, and how to see that code.
FlushVolatile is a function in the MQTT client library used (https://github.com/mqttjs/MQTT.js/blob/main/lib/client.js). This code throws an error that is uncaught by the azureiotdevice module.
Hello Please see attached error log file. For some reason, the node-red container keeps restarting every time I do a deployment. Sometimes after a few minutes, the connection is established, and everything is fine; but sometimes, it just keeps cycling over and over. I am not sure if this is a network communication issue or configuration on the nodes I am using on the flows.
I would appreciate it if you could provide more details about the log that would help me troubleshoot the issue. If there is any other information I need to provide, please let me know.
Thanks
log 08-01-2022.txt