I have a project using an ESP32S2 module that connects to a remote MQTT broker with SSL encryption/authentication. I'm on ESP-IDF branch release/v4.4. It all works well most of the time except with a specific query-response procedure where the the broker publishes a command and the device must respond.
Sometimes the device fails to respond and I see the following log in the monitor:
Code: Select all
E (297861) MQTT_CLIENT: mqtt_message_receive: transport_read() error: errno=119
I (297863) MQTT cloud: MQTT_EVENT_ERROR
I (297863) MQTT cloud: Last error code reported from esp-tls: 0x8008
I (297871) MQTT cloud: Last tls stack error number: 0x0
I (297877) MQTT cloud: Last captured errno : 0 (Success)
E (297883) MQTT_CLIENT: mqtt_process_receive: mqtt_message_receive() returned -1
I (297897) MQTT cloud: MQTT_EVENT_DISCONNECTED
Code: Select all
case MQTT_EVENT_ERROR:
ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
if (event->error_handle->error_type == MQTT_ERROR_TYPE_TCP_TRANSPORT) {
ESP_LOGI(TAG, "Last error code reported from esp-tls: 0x%x", event->error_handle->esp_tls_last_esp_err);
ESP_LOGI(TAG, "Last tls stack error number: 0x%x", event->error_handle->esp_tls_stack_err);
ESP_LOGI(TAG, "Last captured errno : %d (%s)", event->error_handle->esp_transport_sock_errno,
strerror(event->error_handle->esp_transport_sock_errno));
} else if (event->error_handle->error_type == MQTT_ERROR_TYPE_CONNECTION_REFUSED) {
ESP_LOGI(TAG, "Connection refused error: 0x%x", event->error_handle->connect_return_code);
} else {
ESP_LOGW(TAG, "Unknown error type: 0x%x", event->error_handle->error_type);
}
break;
Can anyone help me on how to further diagnose this situation?