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

hawkbit subsystem - prints garbage if debug enabled and no update pending #48863

Closed
gkujawsk opened this issue Aug 10, 2022 · 4 comments · Fixed by #49232, #50708, #50707 or #50706
Closed

hawkbit subsystem - prints garbage if debug enabled and no update pending #48863

gkujawsk opened this issue Aug 10, 2022 · 4 comments · Fixed by #49232, #50708, #50707 or #50706
Assignees
Labels
area: hawkBit bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@gkujawsk
Copy link

I believe I've just hit a bug in hawkbit subsystem. When the hawkbit client debug is enabled (CONFIG_HAWKBIT_LOG_LEVEL_DBG=y) and when there's no update pending on the hawkbit server side the debug may print garbage to the serial console. However, this seems random behaviour and is not reproducible deterministically.

When response_cb() function is parsing HAWKBIT_PROBE the return state is only checked for errors. json_obj_parse() expects to parse out config and _links tokens out of the server response. When there's no _links token parsed the following fields stays uninitialized: hawkbit_results.base._links.deploymentBase.href, hawkbit_results.base._links.cancelAction.href and hawkbit_results.base._links.configData.href. When hawkbit_dump_base() is called the LOG_DBG expects thet deploymentBase.href, cancelAction.href and configData.href points to valid c-string. That's possibly the reason why I get garbage on the serial console.

Json response when there's update pending:
{"config":{"polling":{"sleep":"00:00:30"}},"_links":{"cancelAction":{"href":"https://ota.dot1.pl/default/controller/v1/qwerty/cancelAction/1"},"configData":{"href":"https://ota.dot1.pl/default/controller/v1/qwerty/configData"}}}

Json response when there's no update pending:
{"config":{"polling":{"sleep":"00:00:30"}}}

To Reproduce
Steps to reproduce the behavior: build hawkbit sample, do not provide any updates on hawkbit server side

Expected behavior
No garbage displayed when debug enabled and no update pending. However, this seems random behaviour based on particular build and is not reproducible deterministically.

Impact
Possible application crash.

Logs and console output
[00:03:05.146,000] hawkbit: No update found
[00:04:10.353,000] hawkbit: Polling target data from Hawkbit
[00:04:10.529,000] hawkbit: hawkbit_dump_base: config.polling.sleep=00:01:00
[00:04:10.539,000] hawkbit: hawkbit_dump_base: _links.deploymentBase.href=
�O�n�&���
o��ƞ%�(uM=�����e��A����?����0Ī��)n�Ks{BW [AӟȊ0n�,�Y)�2��j��#�ٚH�Jҋ��7��y [00:29:42.313,000] hawkbit: No update found
hawkbit>MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Booting Zephyr OS build zephyr-v3.1.0-212-g010f61729612

Environment (please complete the following information):

  • OS: MacOS
  • Toolchain: Zephyr SDK
  • Commit SHA or Version used: zephyr-v3.1.0-212-g010f61729612

** Additional context **

  • custom board based on STM32F7
  • zephyr-v3.1.0-212-g010f61729612
@gkujawsk gkujawsk added the bug The issue is a bug, or the PR is fixing a bug label Aug 10, 2022
@mmahadevan108 mmahadevan108 added the priority: low Low impact/importance bug label Aug 16, 2022
@ycsin
Copy link
Member

ycsin commented Aug 17, 2022

Thanks for the report, sounds like this is related to #46072

@ycsin ycsin linked a pull request Aug 18, 2022 that will close this issue
@mmahadevan108
Copy link
Collaborator

@gkujawsk, can you help test the PR and confirm it fixes the issue you reported.

@gkujawsk
Copy link
Author

@mmahadevan108 Yes. It fixed the issue.

@ycsin
Copy link
Member

ycsin commented Sep 11, 2022

@mmahadevan108 Yes. It fixed the issue.

Could you please approve the PR if it fixes the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment