-
Notifications
You must be signed in to change notification settings - Fork 81
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
OPTA freezes after internet disconnection #517
Comments
This is expected, ArduinoIoTCloud tries to re-connect to keep in sync variables with the cloud, the loop should stop as soon as internet connection comes back
Could you please elaborate a bit more on this, the connect action is a blocking call, so while trying to re-connect the sketch loop can't run. As soon as connect() call fails or succeed user loop code is executed and after this the library tries to connect again. Are you using ethernet or wifi? which mbed core version? |
Hello! I am using both Ethernet and Wi-Fi, but both connection methods exhibit this behavior. I understand your answers, but is there any way to solve this? Is there a different method or is it really a condition imposed by the library and there is no solution? |
For Wi-Fi we have recently made some changes to improve this situation. After arduino/ArduinoCore-mbed#962 WiFi.connect() should block for max 7 seconds. You might want to trim this timeout more using WiFi.setTimeout() arduino/ArduinoCore-mbed#976 . The risk is reducing too much the timeout the board will not be able to join the WiFi network. About Ethernet you can reduce this timeout https://github.com/arduino-libraries/Arduino_ConnectionHandler/blob/c72dfdba1ac54fb7898d182e7af5ca73387ead4e/src/EthernetConnectionHandler.h#L47 that by default is blocking for 15s |
I think that even with these updates and information, it will not solve my problem. Even so, the OPTA will still block the execution of the code to try to reconnect. So far, I have had to use 2 OPTAs, one of which is responsible for sending the received data to the Arduino Cloud and the other is the one that executes the offline code. These two OPTAs communicate via Modbus and the offline OPTA always sends this data to whatever is connected to the Cloud. This was a way I managed to solve my problem, because the system cannot crash due to the reconnection. Of course, overall it was a more expensive and extremely laborious solution, but it is functional and worked very well. So far, there is nothing we can do in OPTA to solve this? |
just to make sure I've correctly understood the issue. Does the board crash and/or restart during reconnection? or freeze forever? What i would expect is that it waits for connection for the configured timeout, and then move on with other code, then retry connection again and so on... |
@pennam During this freezing period, it is very bad that the product freezes for a few seconds in my application. In fact, it is extremely critical for me. |
I recently looked into a way to solve something in the Arduino Cloud library where after the OPTA loses its internet connection, the product stops working completely, that is, the program that was running inside the product freezes until the internet comes back on.
In my opinion, this is a big problem. If we have a critical application and the product loses its internet connection, this is a problem. It turns out that when the product loses its internet connection, it enters an infinite reconnection loop and this prevents the OPTA from continuing to perform its functions. Remember that this happens for both the Core M7 and the M4. I also tested several methods within the programming to "bypass" this, but I was unsuccessful.
Is this a bug or is there already a possible fix?
The text was updated successfully, but these errors were encountered: