MQTT No PING_RESP, disconnected -> platform_tick_get_ms() issue
Posted: Fri Apr 17, 2020 9:41 pm
Im lunching mqqt example, getting constantly message No PING_RESP, disconnected, even though MQTT service functioning (reconnecting constantly, but still)
Ive added some debug lines in mqtt_client.c,
and the reason as I see it is platform_tick_get_ms() does not work properly - it returns different values in different functions, and yes, they are not "ticking"
Log output:
Ive added some debug lines in mqtt_client.c,
Code: Select all
ESP_LOGE(TAG, "\r\n in mqtt_write_data() \r\n Platform: %llu,client_tick: %llu, keepalive: %d,\r\n",
platform_tick_get_ms(),client->keepalive_tick, (client->connect_info.keepalive* 1000)/2);
Log output:
Code: Select all
I (4451) MQTT_EXAMPLE: [APP] Connecting to MQTT...
I (4451) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
E (4461) MQTT_CLIENT:
in esp_mqtt_client_init()
Platform: 0,client_tick: 0, keepalive: 60000
E (4471) MQTT_EXAMPLE: -------------------- MQTT CLIENT CREATED --------------------
I (4481) MQTT_EXAMPLE: Other event id:7
I (4481) MQTT_CLIENT: Connecting to: mqtt://192.168.198.151:1883
I (4511) MQTT_CLIENT: Sending MQTT CONNECT message, type: 1, id: 0000
I (4531) MQTT_EXAMPLE: MQTT_EVENT_CONNECTED
E (4531) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927107325128,client_tick: 18446741927107325128, keepalive: 60000,
I (4541) MQTT_EXAMPLE: sent subscribe successful, msg_id=7245
E (4551) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927107325128,client_tick: 18446741927107325128, keepalive: 60000,
I (4561) MQTT_EXAMPLE: sent subscribe successful, msg_id=60928
E (4571) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927107325128,client_tick: 18446741927107325128, keepalive: 60000,
I (4581) MQTT_EXAMPLE: sent subscribe successful, msg_id=9224
I (4581) MQTT_EXAMPLE: MQTT_EVENT_SUBSCRIBED, msg_id=7245
E (4591) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927107617128,client_tick: 18446741927107617128, keepalive: 60000,
E (4601) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927103564129,client_tick: 18446741927103564129, keepalive: 60000,
E (4621) MQTT_CLIENT:
in esp_mqtt_task()
Platform: 18446741926825073129,client_tick: 18446741927103564129, keepalive: 60000
E (4631) MQTT_CLIENT:
in mqtt_write_data()
Platform: 18446741927103613129,client_tick: 18446741927103613129, keepalive: 60000,
E (4641) MQTT_CLIENT:
in esp_mqtt_task()
Platform: 1072513,client_tick: 18446741927103613129, keepalive: 60000
E (4651) MQTT_CLIENT: No PING_RESP, disconnected
E (4661) MQTT_CLIENT:
esp_mqtt_task, after comparison...
Platform: 1061170624000,client_tick: 18446741927103613129, keepalive: 60000