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

AWSIoTDataManager.getShadow() timeout [race condition with AWSIoTDataManager.register()?] #1159

Open
armandr opened this issue Jan 3, 2019 · 7 comments
Assignees
Labels
bug Something isn't working iot Issues related to the IoT SDK

Comments

@armandr
Copy link

armandr commented Jan 3, 2019

State your question

How does one know AWSIoTDataManager.register(withShadow) has completed the registration(finished subscribing)?

In my IoS app I'm calling AWSIoTDataManager.register() with QoS:1 and on success immediately calling AWSIoTDataManager.getShadow(). This often, but not always leads to a AWSIoTShadowOperationStatusTypeTimeout.

It seems possible for getShadow() to be called before register() task has completed subscribing to shadow topics therefore resulting in a timeout.

However, adding a slight delay (as low as 100ms, but more than 10us) in between the register() and getshadow() makes the result more deterministic and successful (at least on my machine and simulator)

The BOOL return value of AWSIoTDataManager.register() is based on the input parameters and does not provide an ACK Callback.

How does one determine that the register is successful and complete so shadow get/update operations can begin?

Which AWS Services are you utilizing?
AWSIoT, AWSCognito

Provide code snippets (if applicable)

let res = self.iotDataManager.register(withShadow: "DATHING", options: ["shadowOperationTimeoutSeconds": "QoS": 1, ": true],
                       eventCallback: { (string1, optype, status, string2, data) in
                      // handle callback
                   })
                   
DispatchQueue.main.asyncAfter(deadline: .now()+0.5 ) {                        
     self.iotDataManager.getShadow("HUMTHING")
}

Environment(please complete the following information):

  • SDK Version: latest
  • Dependency Manager: Cocoapods
  • Swift Version : 4.2

Device Information (please complete the following information):

  • Device: Simulator
  • iOS Version: iOS latest
  • Specific to simulators:
@minbi minbi self-assigned this Jan 4, 2019
@minbi minbi added iot Issues related to the IoT SDK question General question labels Jan 4, 2019
@minbi
Copy link
Contributor

minbi commented Jan 4, 2019

Hi @armandr ,

I took a look at the code and it looks like we don't currently support passing this information back. The subscribe code returns void on this line. I'm marking this as a feature request and also assigning @cbommas who might have more/better information.

@minbi minbi assigned scb01 and unassigned minbi Jan 4, 2019
@minbi minbi added the feature-request Request a new feature label Jan 4, 2019
@frankmuellr frankmuellr removed the question General question label Jan 4, 2019
@AndreaPetrelli
Copy link

I'm in the same situation, there is any news?

@dholdren
Copy link

I'm also running into this issue. seems like a common use-case, register for updates and immediately get the device shadow

@kshrikant
Copy link

@dholdren @AndreaPetrelli @minbi @armandr May i know how did you guys resolved this, I'm facing similar problem while getting shadow ?

@armandr
Copy link
Author

armandr commented Apr 7, 2020

@kshrikant You can try adding a short delay (e.g. 500ms) before getting the shadow and repeat re-try if you still get a timeout.

It's not optimal, but will make the behaviour more deterministic.

@kshrikant
Copy link

@armandr Thank i've added currently delay, let's see if any problem occurs.

@atierian atierian added bug Something isn't working and removed feature-request Request a new feature labels Nov 15, 2023
@ruisebas ruisebas self-assigned this Feb 2, 2024
@harsh62
Copy link
Member

harsh62 commented Feb 20, 2024

Our team is trying to look into the issue and will provide an update soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iot Issues related to the IoT SDK
Projects
None yet
Development

No branches or pull requests

10 participants