-
Notifications
You must be signed in to change notification settings - Fork 69
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
AWS IoT Device Client killing job-enabled processes when STDOUT limit is exceeded #461
Comments
Hi @cah-rita-kassar. Thanks for reaching out to us. I tried to reproduce the issue on my machine and got the expected output which displays the last 1024 characters of the standard output and execution failed. The AWS IoT Device Client logs came as follows: And the job execution results on the AWS IoT Console were as follows: Can you share any more details about the issue like the job document schema or file you are using and the system information if the issue still persists |
Hello @ig15, thank you for your reply Our main concern was actually the job being killed before executing entirely. In this case, it is being killed after the 995th iteration (since it reached the stdout limit) which indicates that echo_stdout_limit.sh script did not finish executing. Our expectations Actual Behavior So if you look back at our echo_stdout_limit.sh script, we have an echo line after the loop to validate whether the script executes entirely or partially. When the script executes entirely, or iterates through the entire loop, we expect to get in the stdout the following echo line "After exceeding stdout limit". Since this line is not being echoed, we can clearly understand that the script is not executing entirely; instead, whenever the stdout limit gets exceeded, the running job will actually be killed instantaneously. |
It is expected to job to be killed. If you check the code over here, we limit any job from printing more than a specific number of log lines to avoid starvation of other pending jobs.
If I see your initial screenshot of logs, I only see DEBUG messages and no ERROR messages were printed. Also it says I think the job execution was completed as expected by device client. I do not understand what is the issue over here. If you wish the device client to not stop printing log lines after reaching the limit then you will have to update the code to either not have any limit or increase the limit as per your use case. You will have to make this change on your side since we won't be able to remove this limit for all of our customers. Also, can you tell us more about your use-case and why you wish to print these many log messages? |
It is not printing because we have a limit of 1000 log lines printed by Device Client per child process. aws-iot-device-client/source/jobs/JobEngine.h Lines 38 to 43 in cf738c8
|
Try updating your script to only loop for 800 times. It should work as expected. Again, can you tell us more about your use-case and why you wish to print these many log messages? |
Yes, I understand that the Client stdout is limited to a 1000 log lines In the previous example mentioned above, we have no problem regarding the log lines being limited, but we do have a concern regarding the last line of our job (touching the file under /tmp directory) not being executed, due to the fact that the stdout limit was reached We were expecting the file to be touched, eventhough the stdout limit got exceeded. In other words, we were expecting the job to execute completely, even though it will only return the last 1024 chars due to the fact that the stdout limit was exceeded. |
To do so, reduce the number of line you input and the job will succeed.
Device client is coded to stop the log line print task once the limit is exceeded. To avoid this from happening you will either have to We won't be able to make this change since for the rest of the customer's we wish to have the same functionality of stopping the Job Execution successfully after the log line limit is breached.
I am not sure if this is possible. The job execution is being executed on a child process. We cannot stop the child process from printing more logs without terminating the child process. Please let me know if you think it is possible and I would encourage you to push a PR for the same. |
Thank you @HarshGandhi-AWS for your time |
@HarshGandhi-AWS it's just that based on the documentation, 'The Jobs feature within the AWS IoT Device Client automatically publishes the last 1024 characters', we expected the client to publish the last 1024 characters but let the job finish executing it. From a technical perspective I thought all stdout would be stored in memory, and finally only the last 1024 lines would be logged and published as the job result. That being said, I understand now that this is meant to work that way and that there are no plans on changing this right? |
Let me check the documentation and check with my team if we want to change the behavior. Give us some time to get back to you on this.
It would not be wise to store it in memory since many IoT devices have memory constraints. It might cause issues for smaller devices and might also affect the performance.
I will have to check with team if we want to change this behavior or not. Let me get back to you on that.
This limit is from IoT Jobs service side. We cannot update that via Device Client. I suspect the service side limit is because of the MQTT message size limits and the update job execution API call request should be sent in 1 MQTT message. This is my assumption. |
Summary
We have built the AWS IoT device client for armv7 architecture and deployed it on our device. We were also able to connect the device to AWS IoT Core and successfully execute jobs. Our job executions successfully reported both standard output and standard error to AWS IoT Core.
Expectation
Running a job with an output that exceeds the limit of 1024bytes, we were expecting the jobs feature within AWS IoT Device Client to publish the last 1024 characters of standard output as part of the job execution update, as mentioned in AWS documentation.
Actual Result
Instead, once the standard output reached its limit, the processes initiated by AWS jobs were unexpectedly terminated and killed abruptly. Afterwards, the job execution was considered successful and the first 1024 characters logged before termination were reported as standard output
Steps To Reproduce
The AWS IoT Device Client config file looks as follows:
The job document is configured to run a script "run.sh" as such:
And our "echo_stdout_limit.sh" contains:
The AWS IoT Device Client logs came as follows:
And the job execution results on the AWS IoT Console were as follows:
The text was updated successfully, but these errors were encountered: