Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 739 forks source link

Provisioning client is not able to try to register after a timeout happened. #2634

Open felipe-clay opened 1 month ago

felipe-clay commented 1 month ago

Using latest SDK release LTS_03_2024_Ref02 and MQTT protocol

When setting the PROV_OPTION_TIMEOUT option, if the client time outs after a call to Prov_Device_Register_Device, it is not able to register when calling Prov_Device_Register_Device again with the same handle.

Is this the expected behaviour? I would expect a new call to Prov_Device_Register_Device would reset the current timeout and start trying again.

Those are the logs when calling Prov_Device_Register_Device while disconnected, then it time outs, and when trying to call Prov_Device_Register_Device it immediately returns the same PROV_OPTION_TIMEOUT error.

20240716T143226.0265Z [Info]:IoTHubLib ProvisioningClient Wait until registration completes Info: Failed DNS lookup for global.azure-devices-provisioning.net: -3 Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:initiate_socket_connection Line:534 DNS resolution failed. Hostname:global.azure-devices-provisioning.net Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:882 lookup_address_and_connect_socket failed Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:853 Invalid open_result. Expected result is IO_OPEN_OK. Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:onOpenComplete Line:458 Error: failure opening connection to endpoint Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:mqtt_error_callback Line:139 MQTT communication error Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1456 Failed opening the underlying I/O. Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1124 Error: io_open failed Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:create_connection Line:645 Failure connecting to mqtt server Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/provisioning_client/src/prov_transport_mqtt_common.c Func:prov_transport_common_mqtt_dowork Line:919 unable to create mqtt connection Error: Time:Tue Jul 16 16:32:46 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/provisioning_client/src/prov_device_ll_client.c Func:Prov_Device_LL_DoWork Line:1203 Timed out connecting to provisioning service 20240716T143246.0294Z [Error]:IoTHubLib ProvisioningClient Failure encountered on registration PROV_DEVICE_RESULT_TIMEOUT 20240716T143246.0294Z [Info]:IoTHubLib ProvisioningClient Waiting 10 seconds before retrying registration 20240716T143256.0294Z [Info]:IoTHubLib ProvisioningClient Wait until registration completes Error: Time:Tue Jul 16 16:32:56 2024 File:/home/felipe/repos/iq2/azure-iot-sdk-c/provisioning_client/src/prov_device_ll_client.c Func:Prov_Device_LL_DoWork Line:1203 Timed out connecting to provisioning service