May I confirm your understanding of the issue?Hi @ESP_tuanpm
I think it's not about re-send the failed packet.
The esp-mqtt library is *not* thread safe at all.
Just think about 2 tasks calling any of esp_mqtt_client_subscribe()/esp_mqtt_client_unsubscribe()/esp_mqtt_client_ping()/ esp_mqtt_client_publish() APIs at the same time on differnct CPU, All the client->mqtt_state.* fields can be racy.
This needs fix.
(1) Are you saying that esp-mqtt is not thread safe when two CPU/tasks are write/reading from a single subscription?
(2) Are you saying that esp-mqtt is not thread safe when two CPU/tasks each owning their own subscription are in use?
Perhaps (1) is acceptable as it is a socket after all. (2) seems a more serious issue.