You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using mosquitto_reconnect_delay_set() but it does not seem to work as advertised.
Both with exponential backof true and false it does not work, I see no backoff at all.
steps to reproduce
Before connecting I set: int ret = mosquitto_reconnect_delay_set(mqtt_instance.m, 3, 60, true);
I connect to an mqtt server which is up, but intentionally with incorrect credentials, so the connection fails with on_connect callback result = 5.
I run mosquitto with mosquitto_loop_forever()
expected behavior
The reconnection attempts should be slower and slower.
if exponential is true: 0s, 3s, 12s, 48s, 60s
if exponential is false: 0s, 3s, 6s, 9s, 12s, 15s, etc..
actual behaviour
I see reconnection attempts happen every 6-7s, and that time does not increase. not when exponential is true, nor when false.
See logging, connection attemps are evenly spaced in time.
Client MyPythonHarm sending CONNECT
Client MyPythonHarm received CONNACK (5)
2018-11-09T14:09:07.038Z:iot.c:125:on_connect 5
2018-11-09T14:09:07.038Z:iot.c:139:on_disconnect res 5
Client MyPythonHarm sending CONNECT
Client MyPythonHarm received CONNACK (5)
2018-11-09T14:09:14.659Z:iot.c:125:on_connect 5
2018-11-09T14:09:14.660Z:iot.c:139:on_disconnect res 5
Client MyPythonHarm sending CONNECT
Client MyPythonHarm received CONNACK (5)
2018-11-09T14:09:22.270Z:iot.c:125:on_connect 5
2018-11-09T14:09:22.271Z:iot.c:139:on_disconnect res 5
version
ii libmosquitto-dev:amd64 1.5.3-0mosquitto1~xenial
On ubuntu 16.04 LTS.
notes
When looking at the source code (lib/loop.c) It seems obvious that the case where reconnect_exponential_backoff is false does not work. Nowhere in the code path is reconnect_delay increased, ever.
For the case when reconnect_exponential_backoff is true, its not clear to me why it doesn't work. It seems that somehow reconnects gets reset to 0 after every connection attempt.
Note that in my case the TCP connection to the mqtt server succeeds, the connection fails due to an code 5 (incorrect credentials (intentional))
The text was updated successfully, but these errors were encountered:
I'm using
mosquitto_reconnect_delay_set()
but it does not seem to work as advertised.Both with exponential backof true and false it does not work, I see no backoff at all.
steps to reproduce
Before connecting I set:
int ret = mosquitto_reconnect_delay_set(mqtt_instance.m, 3, 60, true);
I connect to an mqtt server which is up, but intentionally with incorrect credentials, so the connection fails with on_connect callback result = 5.
I run mosquitto with
mosquitto_loop_forever()
expected behavior
The reconnection attempts should be slower and slower.
if exponential is true: 0s, 3s, 12s, 48s, 60s
if exponential is false: 0s, 3s, 6s, 9s, 12s, 15s, etc..
actual behaviour
I see reconnection attempts happen every 6-7s, and that time does not increase. not when exponential is true, nor when false.
See logging, connection attemps are evenly spaced in time.
version
ii libmosquitto-dev:amd64 1.5.3-0mosquitto1~xenial
On ubuntu 16.04 LTS.
notes
When looking at the source code (lib/loop.c) It seems obvious that the case where reconnect_exponential_backoff is false does not work. Nowhere in the code path is reconnect_delay increased, ever.
For the case when reconnect_exponential_backoff is true, its not clear to me why it doesn't work. It seems that somehow
reconnects
gets reset to 0 after every connection attempt.Note that in my case the TCP connection to the mqtt server succeeds, the connection fails due to an code 5 (incorrect credentials (intentional))
The text was updated successfully, but these errors were encountered: