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
질문됨 2년 전577회 조회
2개 답변
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
답변함 2년 전
  • 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
수락된 답변

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
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠