-
Notifications
You must be signed in to change notification settings - Fork 258
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
Connection aborts when mqtt_resend_queued fails (IDFGH-12830) #277
Comments
Hi @Totrasmek thanks for reporting. Could you elaborate on your testing scenarios? |
Hey @euripedesrocha , in my workspace we have some very poor networks. However, on a good network I recreated the dropouts by adding simulated network delays with What you say about internal errors makes sense, but I would have thought that this code on line 708 of
And that this code from line 714 of
However, if |
Could you share which target are you using? Also, mqtt client configuration and idf version. |
We are using v4.4.6 but aim to move to latest v5.2.1 soon. I'll see if I can get a v5.2.1 test setup so that I can confirm whether or not the issue exists in the latest version. I assumed as the code was quite similar that behaviour would be too, but I might be wrong. Target: ESP32
SDKConfig:
|
@Totrasmek you are correct that the code is quite similar and also is the behavior, but there are some changes between versions, although I don't believe they would impact in this case. Could you also explain your test scenario? I'm not sure I understood how you are emulating the poor network connection. What I meant by internal error was that to have timeouts in the writing path would likely mean that we have our internal buffers full and will not be able to write. Could you set "transport_base" to debug mode and share the logs? You will be able to identify the scenario by the presence of the message: |
Hey @euripedesrocha. I'll explain my test scenario a bit better. To simulate a bad network, I identify the network interface that the laptop is using to connect to the local wifi network by using I've just now tried using
|
Hi @Totrasmek thanks for the added details. |
@Totrasmek Did you ever figure out a solution or workaround for this issue? I am experiencing what appears to be the same error with my MQTT client that is running esp-idf 4.4.6 on an ESP32-S3. |
@movivint could you please open anew issue with detailed description of the problem you are facing? I must point out that 4.4 branch reached EOL and changes will likely not be backported. |
Description
On transmission of data enqueued for sending in the outbox in
mqtt_resend_queued
, a failure ofesp_mqtt_write
will cause an MQTT disconnection. This can interrupt a devices uptime significantly, especially when network conditions are poor. This is because any network delays greater than the network timeout will cause MQTT to disconnect.Code
mqtt_client.c
line 1505Suggested fix
In order to avoid unnecessary disconnects, the conditional check could instead be
(esp_mqtt_write(client) != ESP_OK) && (esp_mqtt_write(client) != ESP_ERR_TIMEOUT)
.The text was updated successfully, but these errors were encountered: