Skip to content
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

Open
DanielfArcos opened this issue Nov 19, 2024 · 3 comments
Open

OPTA freezes after internet disconnection #517

DanielfArcos opened this issue Nov 19, 2024 · 3 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@DanielfArcos
Copy link

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?

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Nov 20, 2024
@pennam
Copy link
Collaborator

pennam commented Nov 20, 2024

Hi @DanielfArcos

It turns out that when the product loses its internet connection, it enters an infinite reconnection loop

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

this prevents the OPTA from continuing to perform its functions

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?

@DanielfArcos
Copy link
Author

Hello!
Thank you for your reply! I am using the latest version available as of today, 11/26/2024.

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?

@pennam
Copy link
Collaborator

pennam commented Nov 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants