-
Notifications
You must be signed in to change notification settings - Fork 7k
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
MQTT reconnect is slow (IDFGH-508) #2850
Comments
projectgus
changed the title
[TW#28001] MQTT reconnect is slow
MQTT reconnect is slow (IDFGH-508)
Mar 12, 2019
david-cermak
added a commit
to espressif/esp-mqtt
that referenced
this issue
Dec 16, 2022
…ng/receiving different data and references esp-mqtt commits to pass these tests testing conditions: transports (tcp, ssl, ws..) qos (0, 1, 2) short repeated messages (packed packets) oversized messages (fragmented packets) publish from a different thread Closes espressif/esp-idf#2870 by means of including commit 815623d from esp-mqtt Closes espressif/esp-idf#2975 by means of including commit 752953d from esp-mqtt Closes espressif/esp-idf#2850 by means of including commits df455d2 17fd713 from esp-mqtt
egnor
pushed a commit
to egnor/esp-mqtt
that referenced
this issue
Dec 23, 2022
…ng/receiving different data and references esp-mqtt commits to pass these tests testing conditions: transports (tcp, ssl, ws..) qos (0, 1, 2) short repeated messages (packed packets) oversized messages (fragmented packets) publish from a different thread Closes espressif/esp-idf#2870 by means of including commit 815623d from esp-mqtt Closes espressif/esp-idf#2975 by means of including commit 752953d from esp-mqtt Closes espressif/esp-idf#2850 by means of including commits df455d2 17fd713 from esp-mqtt
egnor
pushed a commit
to egnor/esp-mqtt
that referenced
this issue
Dec 23, 2022
…ng/receiving different data and references esp-mqtt commits to pass these tests testing conditions: transports (tcp, ssl, ws..) qos (0, 1, 2) short repeated messages (packed packets) oversized messages (fragmented packets) publish from a different thread Closes espressif/esp-idf#2870 by means of including commit 815623d from esp-mqtt Closes espressif/esp-idf#2975 by means of including commit 752953d from esp-mqtt Closes espressif/esp-idf#2850 by means of including commits df455d2 17fd713 from esp-mqtt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MQTT reconnect is slow
Environment
git describe --tags
to find it): v3.3-beta1-64-gd8b625axtensa-esp32-elf-gcc --version
to find it): 1.22.0-80-g6c4433aProblem Description
MQTT takes longer time than necessary to reconnect after network connection has been re-established.
esp-mqtt library is unaware of underlying network connectivity states and current auto reconnect mechanism is built around timed retry attempts every MQTT_RECONNECT_TIMEOUT_MS.
MQTT_RECONNECT_TIMEOUT_MS is set to 10 seconds per default and together with a bug that makes the reconnect delay another MQTT_RECONNECT_TIMEOUT_MS makes MQTT reconnection between 10-20 seconds slower than it has to.
As application code usually keeps track of network connectivity state exporting a new function to force reconnect would help applications that need instant reconnect.
I've opened a pull request on EspressIf/esp-mqtt repo that both export the new reconnect function and solves the above mentioned extra reconnect delay. As it's a submodule I'm not sure you are aware of it.
espressif/esp-mqtt#83
Expected Behavior
Actual Behavior
Steps to reproduce
Notice the initial mqtt connect takes about 2 seconds. Reconnecting takes 10-20 seconds.
Code to reproduce this issue
examples/protocols/mqtt/ssl example application with patch 0001-MQTT-slow-reconnect-example.patch applied.
Solution
Notice both initial mqtt connect and reconnect takes about 2 seconds.
Other items if possible
0001-MQTT-slow-reconnect-example.patch.txt
0002-Force-MQTT-reconnect-on-wifi-connected.patch.txt
The text was updated successfully, but these errors were encountered: