-
Notifications
You must be signed in to change notification settings - Fork 72
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
Non-persistent config shadow changes #488
Comments
Hi @AleksandarGT , thanks for bringing up the issue. We are looking into it and will get back to you. |
Hey @AleksandarGT. Can you build with the changes in this PR to confirm if it fixes the problem you're facing: #490 |
The changes to the shadow via aws now reflects to the configuration file. However, when making a change to the shadow via the cloud, the config changes for the jobs get includeStdOut omitted. This happens even if I change another configuration option not for the jobs. Before
after
Also we use fleet provisioning, so when the initial provisioning is complete a file is created .aws-iot-device-client/aws-iot-device-client-runtime.conf When I make a change to the config shadow via the cloud, the information from there gets copied over to the aws-iot-device-client.conf. The whole 'runtime-config' json wasn't a part of the configuration before the shadow update. I am not sure this is desired behavior.
Also on making a config update via the shadow, the changes will be applied on next execution of the iot device client. Is there a way to trigger the device client to restart itself, or at least stop so the service executes it again? Otherwise we need to trigger a job that will restart the service. |
Can you tell us what your exact use case is, for passing the 'includeStdOut' field in the configuration file since its a parameter in a job document and not a field for the configuration file of device client itself? Coming to the behavior you are experiencing, since device client is meant to update the entire configuration state of the device as part of the config shadow feature to the cloud, therefore updating the local file with the shadow state is expected to override the configuration with what was stored in cloud. And since 'includeStdOut' was never handled and stored in cloud initially, it was overidded when we try to override the local configuration file. Coming to triggering device client restart automatically upon updating config shadow from the cloud: This can be implemented on a use case specific basis but should not be added to our library since often times users don't want the device to restart with new configurations immediately but instead want to control that behavior on their own will via a restart job and we'd like to keep it that way. |
You're correct I was passing 'includeStdOut' in the config file when it should've been in the job document itself. As for the runtime config json it doesn't really interfere with the other configuration options. For device restart it still could be a nice config options that can be added in the future when the device receives a config shadow update to automatically restart. Until then pushing jobs for restart also works. Not really a part of this issue but I'd like to mention so you can monitor this issue further is that if a device receives more than 1 job request without restarting, the first job will execute fine, but the second one will get stuck during execution. The second job will either timeout if the job is configured for that, or it will be permanently stuck. Restarting the device sometimes doesn't even work because iot device client prevents the device from rebooting normally and a hard power off / power on is required. To fix this we just enforce the device to restart on every job completion so this problem didn't happen after that. |
Thanks for your response @AleksandarGT . Appreciate your inputs here. With respect to the latter section of your response, can you provide the steps for reproducing the undesired jobs behavior (preferably in a new issue)? |
The PR adding a new field to trigger Config Shadow persistent updates has been merged. Closing this issue. |
I have enabled config shadows in the configuration because we'd like to change the configuration on demand from the cloud directly. However, the changed configuration is not persistent. After changing the config shadow, if I restart the aws device client service the changes are applied but are not saved in the actual configuration file, so on next service restart / device reboot the changes will revert back to the real configuration file.
It's important to note that we have registered the device client as our own service rather than the automatic way through the setup cli because we had problems, I am not sure if this has anything to do with the current issue.
Our own service file:
[Unit]
Description=AWS IoT Device Client
Wants=network-online.target
After=network.target network-online.target
[Service]
User=sens
Type=simple
Environment="CONF_PATH=/home/sens/.aws-iot-device-client/aws-iot-device-client.conf"
ExecStart=/home/sens/aws-iot-core-connection/aws-iot-device-client/build/aws-iot-device-client --config-file $CONF_PATH
StandardOutput=append:/home/sens/aws-iot-core-connection/aws-iot-device-client/logs/system.log
StandardError=append:/home/sens/aws-iot-core-connection/aws-iot-device-client/logs/system-error.log
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
The text was updated successfully, but these errors were encountered: