-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Client reconnection bug #383
Comments
show your reconn_setting and log |
When I start the service and disconnect the network for a period of time, then restore the connection, it keeps triggering the [onClose] and [onConnect] callback repeatedly. The following logs are outputted in the libhv.log file: 2023-05-18 09:49:25.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:49:25.861 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:49:50.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:49:50.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:50:01.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:50:01.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:50:12.860 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping]
2023-05-18 09:50:12.861 ERROR mqtt no pong! [mqtt_client.c:51:mqtt_send_ping] Here is my reconn_setting p_mqtt = new hv::MqttClient();
reconn_setting_t reconn;
reconn_setting_init(&reconn);
reconn.min_delay = 1000;
reconn.max_delay = 10000;
reconn.delay_policy = 2;
p_mqtt->setReconnect(&reconn);
p_mqtt->setPingInterval(10); |
Log is very clear, your mqtt server not response pong, you can try |
I did a packet capture test with wireshark. When I start the program, the program can send ping normally, and the server can also send pong normally. Then when I disconnect from the network for a period of time, the program’s reconnection mechanism will be triggered. At this time, the program will no longer actively send ping, so it cannot jump out of the reconnection loop. |
When my MQTT client connects to the server for a certain period of time, [onClose] and [onConnect] will be continuously and infinitely called.
The text was updated successfully, but these errors were encountered: