Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

[BUG] Trace output of ESP32-DevKitC jobs demo is clobbered #3543

Open
cookpate opened this issue Oct 19, 2022 · 2 comments
Open

[BUG] Trace output of ESP32-DevKitC jobs demo is clobbered #3543

cookpate opened this issue Oct 19, 2022 · 2 comments

Comments

@cookpate
Copy link
Member

cookpate commented Oct 19, 2022

Describe the bug
A help message is printed out when the jobs_for_aws demo first runs. On the ESP32 DevKit at least, the message ends up clobbered and doesn't print out in full. I initially thought I was going to a dead link in the docs.

System information

  • Hardware board: ESP32-DevKitC
  • IDE used: ESP-IDF
  • Operating System: Windows
  • Code version: 202107.00-81-g49e7fe5d6
  • Project/Demo: Jobs_Demo

Expected behavior
The help message should be displayed in full without any clobbering as shown:

LogInfo( ( "\r\n"
"/*-----------------------------------------------------------*/\r\n"
"\r\n"
"The Jobs demo is now ready to accept Jobs.\r\n"
"Jobs may be created using the AWS IoT console or AWS CLI.\r\n"
"See the following link for more information.\r\n" ) );
LogInfo( ( "\r"
"https://docs.aws.amazon.com/cli/latest/reference/iot/create-job.html\r\n"
"\r\n"
"This demo expects Job documents to have an \"action\" JSON key.\r\n"
"The following actions are currently supported:\r\n" ) );
LogInfo( ( "\r"
" - print \r\n"
" Logs a message to the local console. The Job document must also contain a \"message\".\r\n"
" For example: { \"action\": \"print\", \"message\": \"Hello world!\"} will cause\r\n"
" \"Hello world!\" to be printed on the console.\r\n" ) );
LogInfo( ( "\r"
" - publish \r\n"
" Publishes a message to an MQTT topic. The Job document must also contain a \"message\" and \"topic\".\r\n" ) );
LogInfo( ( "\r"
" For example: { \"action\": \"publish\", \"topic\": \"demo/jobs\", \"message\": \"Hello world!\"} will cause\r\n"
" \"Hello world!\" to be published to the topic \"demo/jobs\".\r\n" ) );
LogInfo( ( "\r"
" - exit \r\n"
" Exits the demo program. This program will run until { \"action\": \"exit\" } is received.\r\n"
"\r\n"
"/*-----------------------------------------------------------*/\r\n" ) );

Screenshots or console output

14 495 [iot_thread] [jobs_demo.c:833] [INFO] [JobsDemo]
/*-----------------------------------------------------------*/

The Jobs demo is now ready to accept Jobs.
https://docs.aws.amazon.com/cli/latest/reference/iot/create-job.htmlJobsDemo]

 - print          ] [jobs_demo.c:843] [INFO] [JobsDemo]  key.
   Logs a message to the local console. The Job document must also contain a "message".
 - publish        "action17 495 [iot_thread] [jobs_demo.c:846] [INFO] [JobsDemo]
   Publishes a message to an MQTT topic. The Job document must also contain a "message" and "topic".


   For example: { "action": "publish", "topic": "demo/jobs", "message": "Hello world!"} will cause
 - exit           to be published 19 495 [iot_thread] [jobs_demo.c:854] [INFO] [JobsDemo]
   Exits the demo program. This program will run until { "action": "exit" } is received.

/*--------------------20 495 [iot_thread] [mqtt_demo_helpers.c:565] [INFO] [MQTT] Attempt to subscribe to the MQTT topic $aws/things/cookpateESP32-TestBoard/jobs/notify-next.

Steps to reproduce bug
Example:
1. Configure to run the Jobs Demo (#define CONFIG_JOBS_DEMO_ENABLED in aws_demo_config.h)
2. In the root directory with a configured ESP32 thing plugged in, flash and monitor the demo

@cookpate
Copy link
Member Author

cookpate commented Oct 19, 2022

This actually looks more like a race condition in LogInfo for this demo. IT should have printed out an example job, but this is an example console output in the ESP-IDF 4.2 PowerShell window:

14 495 [iot_thread] [jobs_demo.c:833] [INFO] [JobsDemo]
/*-----------------------------------------------------------*/

The Jobs demo is now ready to accept Jobs.
https://docs.aws.amazon.com/cli/latest/reference/iot/create-job.htmlJobsDemo]

 - print          ] [jobs_demo.c:843] [INFO] [JobsDemo]  key.
   Logs a message to the local console. The Job document must also contain a "message".
 - publish        "action17 495 [iot_thread] [jobs_demo.c:846] [INFO] [JobsDemo]
   Publishes a message to an MQTT topic. The Job document must also contain a "message" and "topic".


   For example: { "action": "publish", "topic": "demo/jobs", "message": "Hello world!"} will cause
 - exit           to be published 19 495 [iot_thread] [jobs_demo.c:854] [INFO] [JobsDemo]
   Exits the demo program. This program will run until { "action": "exit" } is received.

/*--------------------20 495 [iot_thread] [mqtt_demo_helpers.c:565] [INFO] [MQTT] Attempt to subscribe to the MQTT topic $aws/things/cookpateESP32-TestBoard/jobs/notify-next.

This is printed out from here:

LogInfo( ( "\r\n"
"/*-----------------------------------------------------------*/\r\n"
"\r\n"
"The Jobs demo is now ready to accept Jobs.\r\n"
"Jobs may be created using the AWS IoT console or AWS CLI.\r\n"
"See the following link for more information.\r\n" ) );
LogInfo( ( "\r"
"https://docs.aws.amazon.com/cli/latest/reference/iot/create-job.html\r\n"
"\r\n"
"This demo expects Job documents to have an \"action\" JSON key.\r\n"
"The following actions are currently supported:\r\n" ) );
LogInfo( ( "\r"
" - print \r\n"
" Logs a message to the local console. The Job document must also contain a \"message\".\r\n"
" For example: { \"action\": \"print\", \"message\": \"Hello world!\"} will cause\r\n"
" \"Hello world!\" to be printed on the console.\r\n" ) );
LogInfo( ( "\r"
" - publish \r\n"
" Publishes a message to an MQTT topic. The Job document must also contain a \"message\" and \"topic\".\r\n" ) );
LogInfo( ( "\r"
" For example: { \"action\": \"publish\", \"topic\": \"demo/jobs\", \"message\": \"Hello world!\"} will cause\r\n"
" \"Hello world!\" to be published to the topic \"demo/jobs\".\r\n" ) );
LogInfo( ( "\r"
" - exit \r\n"
" Exits the demo program. This program will run until { \"action\": \"exit\" } is received.\r\n"
"\r\n"
"/*-----------------------------------------------------------*/\r\n" ) );

@cookpate cookpate changed the title [BUG] Documentation: Trace Output of ESP32-DevKitC Jobs Demo Has Dead Link [BUG] Trace output of ESP32-DevKitC jobs demo is clobbered Oct 20, 2022
@cookpate
Copy link
Member Author

Ah, it looks like the carriage return at the beginning of log messages isn't overwriting the current line. It's a hacky way of suppressing the log message header.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant