-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I have been testing the MQTT toolkit on a sbRIO and have found a problem when the internet connection is lost. The main process vi, vi.lib\LabVIEW Open Source Project\MQTT Connection\MQTT_Base\Session\process.vi, that handle the actual receiving and transmitting of data with the broker does not close properly when running on a real-time target and the internet connection is lost. When I run the example vis on windows and simulate a lost of internet by disconnecting the network cable, everything seems to be handled properly. But when executed on an RT system, it does not.
What I have found on the RT system,
- This loop will exit with error 56
- This loop never exits
This leave the process vi still running and my main code would never see a disconnect so that I could try and re-connect.
The fix that I have found is to change the setConnected vi, vi.lib\LabVIEW Open Source Project\Connection\Connection\setConnected.vi.
- Original code
- My fix, remove the error case structure
The reason I think this is more of a bug fix is because of the calling Write vi, vi.lib\LabVIEW Open Source Project\Connection\Connection\Write.vi,
If an error is generated by this vi and goes to the error case to call setConnected, within the original vi, the error case is preventing it from clearing the connected flag which in turns prevents my software from knowing that it is disconnected which lead to my software continually trying to publish data to a queue that is still valid but no longer being emptied. This leads to my rio crashing for running out of memory. By removing the error case in setConnected allows for the connected flag to be cleared and the calling software can handle it accordingly. The bigger question is why does it act differently from windows to RT and I have no clue.
This is being tested on sbRIO-9637 with LV2024.