-
Notifications
You must be signed in to change notification settings - Fork 737
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
Help needed with connectionStatusCallback not triggered when sending control packet data failed #2627
Comments
Good morning, We've been investigating this issue on our devices. Our theory is that the problem comes from the MQTT connection between the device and IoT Hub. Below there's the expected SDK behaviour based on the code review:
Here's our steps to reproduce the behaviour at SDK level (We've been doing the tests with LTS_08_2024 version of SDK):
From there, we started checking the code:
The ping is sended from the highlighted lines below (see mqtt_client.c -> mqtt_client_dowork The implementation of sendPacket controls some causes of failure when trying to execute. If it fails, it generates a MU_FAILURE that does not update the packetSendTimeMs. Coming back to the mqtt_client_dowork routine, the result of the sendPacketItem is not catched. Because of that, the tickcounter_get_current_ms is never executed. The code that generates the callback is never executed, so the device does not know it is not connected. And does not try to connect again. After reviewing the code, we applied a patch on the mqtt module in order to avoid this infinite loop (file mqtt_client_modified attached): In the file mqtt_client_modified.c we have modified the mqtt_client.c to add some logs on our screen and apply the patch If you define If you define Here is the behaviour with the patch applied, the device did not enter into the infinite loop and started the reconnection process successfully. In the following zip there are the original and modified files. The modified includes the patch code. |
We opened a new issue as a bug as a continuation of this thread. You can find it here: |
We are encountering an issue with the Azure IoT SDK for ESP32.
SDK version: LTS_03_2024
When the following error trace appears:
Error: Time: File:./components/esp-azure/port/src/tlsio_esp_tls.c Func:tlsio_esp_tls_send_async Line:552 tlsio_esp_tls_send_async without a prior successful open
Error: Time: File:./components/esp-azure/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:sendPacketItem Line:393 Failure sending control packet data
the connectionStatusCallback with the result IOTHUB_CLIENT_CONNECTION_UNAUTHENTICATED is not being triggered, and the error appears indefinitely. In all other cases of connection and disconnection, the callback is triggered correctly. (so , in general, the callback worked excepting this case)
In this case, the hub sees the client as disconnected, but our software cannot take any action to reconnect without the callback, as it is our only tool to get connectivity feedback.
What other method can we use to confirm that the periodic control packet has been sent successfully?
It's crucial for us to keep data consumption minimal. We know that if any telemetry is sent in this state, your SDK reports that the message wasn't delivered and our software can start the reconnection procedure.. However, constantly sending messages for connectivity checks isn't feasible.
Essentially, we need a method to detect and handle this situation effectively.
Thank you.
The text was updated successfully, but these errors were encountered: