-
Notifications
You must be signed in to change notification settings - Fork 634
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
Shadow JSON version number doesn't always increase #32
Comments
Hi @tomghuang, Rahul |
FWIW, I'm working on moving our version of the IoT C SDK (Texas Instruments, CC3200). I first moved our code base from AWS v1.1.1 --> AWS v2.0.0 - I did not see this issue in the shadow console application. I have since moved forward, from AWS v2.0.0 --> AWS v2.1.0 - and now I see the "Old Delta Message received" problem. So, it seems that it's due to some change between AWS v2.0.0 --> AWS v2.1.0 Cheers, Steve |
Hi @stconnell, We are still discussing internally how we should maintain consistency for shadow version updates while still being able to receive update/accepted messages. I will update this issue further when we have a fix out. Please let us know if you continue to have the issue after making the above change, or if you have any other suggestions. Rahul |
Hi Rahul, Thanks for your prompt reply. I made the change to aws_iot_shadow_records.c to remove the check for update/accepted and the example again works as it did previously. However, we are a bit hesitant to deviate from the AWS code for the TI release of the SDK (that will sync us up to v2.1.0). I understand that you're still working on how to best handle this issue, but it would help us to know if you think you expect to leave in the check for update/accepted in the if statement (at line 173) or to keep that check there, and then add some additional logic to handle this properly elsewhere. For example, if you foresee that you will end up reverting that change to how it was in v2.0.0, then we wouldn't have any issue modifying the code to remove the same (as this would be equivalent to making the change ahead of you guys). It may make sense to open a private email discussion on this with you (and or the team). If you agree, I'll reach out via email. Cheers, Steve |
Hi Rahul, Per our email discussion, I'm going to go with calling the following function to disable the "discard old delta messages" feature:
I like this approach better because I don't have to modify Amazon's framework code. The call to this function can be added to the application, which is better in my opinion. Thanks for your help. Cheers, Steve |
Change log for v2.1.0-ti: +++++++++++++++++++++++++ - Major changes to support AWS v2.1.0 - Re-worked directory structure to follow suit of AWS 2.x directory organizational changes - Updated README_CC3200.md file to fix stale links and to make the instructions consistent with the changes in this release. - Re-worked timer code to fix bugs and better handle edge cases related to clock wrap of the uint32_t timer. - Added definition of newly supported (by AWS framework) struct "TLSDataParams" into timer_platform.h. Struct holds TLS handle and socket, which previously required a dynamic memory allocation that to store this information in network_sl.c (the dynamic allocation code has now been removed). - Fixed bug in aws_iot_read() that would cause the program to block indefinitely on a recv() call (and hence lose connection with the server) - MQTT maximum reconnect wait time increased to 128 seconds for all examples, per AWS 2.x changes to aws_iot_config.h - Increased the subscribe publish example's MQTT command timeout to 20 seconds, per AWS 2.x changes. - Updated subscribe publish example to send QoS level one messages, per AWS 2.x changes. - Added workaround to the shadow console echo example, in order to disable an AWS 2.1.0 feature that causes warning messages and the shadow to get out of sync with the application. (This is checked into a separate commit, please refer to that commit's message and below "Known Issues" for further details) Known Issues: +++++++++++++ - The subscribe publish example fails intermittingly after long test runs (~24 hours). The failure is due to a QoS 1 PUBACK never being received. This issue is still under investigation. A bug report has been filed in Jira in order to track this: - AWSIOT-1 "Sub/pub ex fails to get QoS1 ACK from mosquitto server on soak test" - Support for the newly added (in AWS v2.0.0) pthread layer is not present but will be added in a future release. - AWS 2.1.0 introduced a change related to the acceptance of shadow updates, which causes shadow version numbers to get out of sync and also results in a warning message. The following function call can be made within the application in order to work around this: aws_iot_shadow_disable_discard_old_delta_msgs() Refer to the following thread for details: aws/aws-iot-device-sdk-embedded-C#32
This file contains a work around that remedies the following message seen at run time: WARN: shadow_delta_callback L#506 Old Delta Message received - Ignoring rx: 222 local: 222 This warning is due to a chnange to the AWS framework code introduced in v2.1.0. The workaround is to disable the discarding of old delta messages, as recommended by Amazon. Please refer to the following forum thread or full details: aws/aws-iot-device-sdk-embedded-C#32
I tried to build and run the sample under
samples/linux/shadow_sample_console_echo
to learn the behavior of AWS IoT Shadow Service. I tried to switch the desiredwindowOpen
state betweentrue
andfalse
, and expect the device can always receive the delta message. However, about 30% of my testing I received the following message:It means that, although I've successfully changed the desired
windowOpen
from true to false, the device didn't received the delta message, because the SDK consider the received delta message is an old one (with version number 222). This is wrong, because when I change the desired state, the device should receive the delta message.After tracing the code in
aws_iot_shadow_records.c
, I found that the bug is caused by receiving two separate messages with the same version number.In my case, I received an
update/accepted
message first:Then I received an
update/delta
message with the same version number (222) and the same timestamp:This will cause the following code snippet in the
shadow_delta_callback
function inaws_iot_shadow_records.c
think that the delta message is not new:That's because the
shadowJsonVersionNum
variable has been set to 222 in theAckStatusCallback
function when the device received theupdate/accepted
message.I think the solution is either guarantee that each separate message should have an incremental, unique version number, or the SDK should use a separate variable to track the latest delta message version number.
The text was updated successfully, but these errors were encountered: