Timeouts using aws-iot-device-sdk-python

0

Hey, we are using IoT Core Shadows with ROS and Python (that's why we use the SDK v1 and not v2) and we get timeouts while trying to send shadow updates fairly frequently. Sometimes when starting everything, sometimes only after the process ran for some time.

It doesn't seem to be our connection (everything else runs without problems), what would be a good starting point in debugging this?

  • I haven't found anything related in the cloudwatch logs.
  • The IoT device and the server are in mid europe
WDDev
asked 2 years ago585 views
2 Answers
3

By chance are you using the aws-iot-device-sdk-python library? And then also sending the shadow update message in the same thread that receives a IoT topic (including receiving other shadow updates)? For reasons I have never fully understood, sending a IoT message in the callback thread (after receiving a message on a subscription) will throw a publish timeout error. If this is the case there are a couple of things you can do to try and resolve the problem.

  1. Spin up a worker thread to publish your shadow changes.
  2. Migrate your code to the newer [aws-iot-device-sdk-python-v2 library] (https://github.com/aws/aws-iot-device-sdk-python-v2).

A couple of further general suggestions to try and help narrow down the causes.

  1. Since publishing to IoT Shadows are really just publishing messages to special IoT topics, test whether or not you can consistently publish to a non-shadow topic. This will tell you if it's a problem with the shadow service or a general problem with IoT publishing.
  2. Make sure you are publishing with QoS 1, which sends back receive receipts.
  3. Set your code up such that if you get a publish timeout do a ping to your IoT endpoint. If the ping times out, this would tell you the problem is general networking versus IoT.
Erik
answered 2 years ago
  • Your first suggestion already did the trick, thank you very much!

  • Well, it seemingly only helped for some time, now the timeouts are back

0
Accepted Answer

There was an update to the sdk in december 2021 which fixed the issue for me. Currently (Jan. 2022) you need to install it manually from github to use it.

WDDev
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions