gedemagt
gedemagt

Reputation: 697

Timeouts and connectivity status in the synchronous python azure-iot-hub client

I am currently using the synchronous client from azure-iot-sdk here. I am experiencing some odd behavior which raises two questions:

  1. Is it possible to set a timeout on calls using the synchronous client? I have experienced that the sending a message hangs forever, if I ran out of message quota in the IotHub, and it therefore never replies in the MQTT protocol.
  2. Is this the only way of checking connectivity? Because this only checks if the MQTT connection has been established, but not whether the IotHub is responding. This can result in sending a message and waiting for a response for ever, effectively blocking my thread. I have experienced issues with this both if I ran out of messages, but also with an outage of the IoTHub.

I know some of this could be solved with switching to asyncio, but that would require a major rewrite.

UPDATE:

For future reference, there seems to be other people discussing these issues:

Github Issue 1

Github Issue 2

Github Issue 3

Github PR

Upvotes: 0

Views: 534

Answers (1)

Carter Tinney
Carter Tinney

Reputation: 43

  1. It is not possible to set a timeout when using the synchronous client at this time. We are considering adding this support in the future, but currently it is unviable.

  2. Yes, that is the only way of checking the connectivity. Running out of message quota has no bearing on whether or not the client is connected. There is unfortunately no way for us to report on the device side when the message quota has exceeded. You must keep track of your own quota.

Additionally, I would suggest that you file a GitHub issue if you are experiencing some kind of client hanging. This behavior is supposed to have been addressed - if this is occurring, we would like to know, and would like to see your logs.

-Carter, Microsoft developer, azure-iot-device SDK

Upvotes: 2

Related Questions