Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: infinite disconnect loop #485

Closed
wants to merge 1 commit into from

Conversation

zfields
Copy link
Contributor

@zfields zfields commented Jul 2, 2024

When a disconnect occurs, a reset message is provided to both the _thing and _device containers, but there is no subsequent call to _thing.update() or _device.update() to process the message and actually reset the state.

This results in an infinite loop, because !_device.connected() (i.e. not not disconnected) will ALWAYS remain true.

This seems like the appropriate place for the call to update(), because ResetCmdId puts the _device and _thing containers into their disconnected state then update() processes the disconnect and restores them to their initialization state (same state that results from begin() just before we enter the state machine).

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.26%. Comparing base (8b6ff40) to head (e1b955b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #485   +/-   ##
=======================================
  Coverage   95.26%   95.26%           
=======================================
  Files          32       32           
  Lines        1478     1478           
=======================================
  Hits         1408     1408           
  Misses         70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jul 2, 2024

Memory usage change @ e1b955b

Board flash % RAM for global variables %
arduino:esp32:nano_nora 🔺 +16 - +16 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_edge:edge_control 🔺 0 - +64 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:mbed_giga:giga 🔺 0 - +64 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 0 - +16 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nicla:nicla_vision 🔺 0 - +64 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 🔺 0 - +64 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 🔺 0 - +16 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:renesas_uno:unor4wifi 🔺 +16 - +16 +0.01 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkr1000 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrgsm1400 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrnb1500 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1300 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
esp32:esp32:esp32 🔺 +12 - +20 0.0 - 0.0 0 - 0 0.0 - 0.0
esp8266:esp8266:huzzah 🔺 +16 - +16 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/ArduinoIoTCloud-Advanced
flash
% examples/ArduinoIoTCloud-Advanced
RAM for global variables
% examples/ArduinoIoTCloud-Basic
flash
% examples/ArduinoIoTCloud-Basic
RAM for global variables
% examples/ArduinoIoTCloud-Callbacks
flash
% examples/ArduinoIoTCloud-Callbacks
RAM for global variables
% examples/ArduinoIoTCloud-Schedule
flash
% examples/ArduinoIoTCloud-Schedule
RAM for global variables
% examples/utility/ArduinoIoTCloud_Travis_CI
flash
% examples/utility/ArduinoIoTCloud_Travis_CI
RAM for global variables
% examples/ArduinoIoTCloud-DeferredOTA
flash
% examples/ArduinoIoTCloud-DeferredOTA
RAM for global variables
% examples/utility/Provisioning
flash
% examples/utility/Provisioning
RAM for global variables
% examples/utility/SelfProvisioning
flash
% examples/utility/SelfProvisioning
RAM for global variables
%
arduino:esp32:nano_nora 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0
arduino:mbed_edge:edge_control 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 64 0.01 0 0.0
arduino:mbed_giga:giga 64 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 64 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_nano:nanorp2040connect 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_nicla:nicla_vision 64 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 64 0.0 0 0.0 0 0.0 0 0.0 64 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_opta:opta 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 64 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 0 0.0 0 0.0
arduino:renesas_uno:unor4wifi 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0
arduino:samd:mkr1000 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 0 0.0 0 0.0
arduino:samd:mkrgsm1400 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 0 0.0 0 0.0
arduino:samd:mkrnb1500 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 16 0.01 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1300 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwifi1010 8 0.0 0 0.0 8 0.0 0 0.0 16 0.01 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:nano_33_iot 8 0.0 0 0.0 8 0.0 0 0.0 16 0.01 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 8 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
esp32:esp32:esp32 16 0.0 0 0.0 20 0.0 0 0.0 12 0.0 0 0.0 20 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0
esp8266:esp8266:huzzah 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0 16 0.0 0 0.0
Click for full report CSV
Board,examples/ArduinoIoTCloud-Advanced<br>flash,%,examples/ArduinoIoTCloud-Advanced<br>RAM for global variables,%,examples/ArduinoIoTCloud-Basic<br>flash,%,examples/ArduinoIoTCloud-Basic<br>RAM for global variables,%,examples/ArduinoIoTCloud-Callbacks<br>flash,%,examples/ArduinoIoTCloud-Callbacks<br>RAM for global variables,%,examples/ArduinoIoTCloud-Schedule<br>flash,%,examples/ArduinoIoTCloud-Schedule<br>RAM for global variables,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>flash,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>RAM for global variables,%,examples/ArduinoIoTCloud-DeferredOTA<br>flash,%,examples/ArduinoIoTCloud-DeferredOTA<br>RAM for global variables,%,examples/utility/Provisioning<br>flash,%,examples/utility/Provisioning<br>RAM for global variables,%,examples/utility/SelfProvisioning<br>flash,%,examples/utility/SelfProvisioning<br>RAM for global variables,%
arduino:esp32:nano_nora,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0
arduino:mbed_edge:edge_control,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,64,0.01,0,0.0,,,,
arduino:mbed_giga:giga,64,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,64,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_nano:nanorp2040connect,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_nicla:nicla_vision,64,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,64,0.0,0,0.0,0,0.0,0,0.0,64,0.0,0,0.0,0,0.0,0,0.0,,,,
arduino:mbed_opta:opta,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,64,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,,,,
arduino:renesas_portenta:portenta_c33,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,,,,,0,0.0,0,0.0,,,,
arduino:renesas_uno:unor4wifi,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,,,,,,,,,,,,
arduino:samd:mkr1000,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,,,,,0,0.0,0,0.0,,,,
arduino:samd:mkrgsm1400,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,,,,,0,0.0,0,0.0,,,,
arduino:samd:mkrnb1500,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,16,0.01,0,0.0,,,,,0,0.0,0,0.0,,,,
arduino:samd:mkrwan1300,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,,,,,,,,,
arduino:samd:mkrwifi1010,8,0.0,0,0.0,8,0.0,0,0.0,16,0.01,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:nano_33_iot,8,0.0,0,0.0,8,0.0,0,0.0,16,0.01,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,8,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
esp32:esp32:esp32,16,0.0,0,0.0,20,0.0,0,0.0,12,0.0,0,0.0,20,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,,,,,,,,
esp8266:esp8266:huzzah,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,16,0.0,0,0.0,,,,,,,,,,,,

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jul 2, 2024
@pennam
Copy link
Collaborator

pennam commented Jul 18, 2024

Thanks for the headsup @zfields . I would fix this with #490 . Do you have time to give it a spin?

@zfields
Copy link
Contributor Author

zfields commented Jul 18, 2024

Yes. I'd be happy to. I'm testing now, so it won't be a problem.

@pennam
Copy link
Collaborator

pennam commented Jul 22, 2024

superseded by #490

@pennam pennam closed this Jul 22, 2024
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jul 22, 2024
@zfields zfields deleted the zak-reset branch July 22, 2024 12:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
conclusion: duplicate Has already been submitted topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants