Closed LucasIssardWatts closed 1 year ago
Any ideas :confused: ?
I think the issue is located in /demos/projects/ESPRESSIF/esp32/components/sample-azure-iot/transport_tls_esp32.c
file, when trying to establish TLS connection but I don't understand why...
Hi @LucasIssardWatts, if the wi-fi connection your device is connecting to is unreliable, you can increase the number of attempts by modifying sampleazureiotRETRY_MAX_ATTEMPTS
or increasing the delay in between attempts by modifying sampleazureiotRETRY_BACKOFF_BASE_MS
and sampleazureiotRETRY_MAX_BACKOFF_DELAY_MS
. These variables are in sample_azure_iot
Hi @RLeclair ! Thank you for your reply 👍.
I've already tried to fine tune these values but without significant improvement.
The only solution I've found to this problem is to restart Wi-Fi connection by using esp_wifi_stop()
and esp_wifi_start()
to make a new try. You'd think the problem is the ESP32's Internet connection. However, Wi-Fi connection seems correct, since I can synchronize SNTP without any problem.
Hi @LucasIssardWatts, does restarting the Wi-Fi connection always fix the issue (does the new try always work)? If not, that would point toward the network being unstable for long periods of time which might require a longer delay in between retries than what you tried.
We currently don't have plans on implementing our sample with network re-initialization as our code is not meant to be production-ready.
Hi, after further tests, restarting the Wi-Fi connection solves the problem most of the time but not always (it solves the problem 8 times /10). So, I implemented a network re-initialization process in my code to improve reliability. Thanks.
Hi everyone 👋 !
This issue is for a:
Randomly, my ESP32 fails to open a connection with the IoT Hub and returns the error you can see below. This bug is relatively rare and unpredictable (which makes it particularly unpleasant to correct) but is blocking because the device remains in a disconnected state until the next restart. This problem only appears on one of my Wi-Fi networks, which is probably the least reliable. When the problem occurs, the ESP32 is still connected to the Internet, of course.
Log messages given by the failure
Here's an extract of the code where the bug appears (prvConnectToServerWithBackoffRetries function) :
Versions
How can I improve reliability ?
Thanks for your help !