Problems with native_ota example
Posted: Thu Oct 17, 2024 3:00 pm
Hi
I'm trying to get the native_ota example from the Espressif IDE (5.3.1) to work.
Code compiles fine and runs.
I've got a PC running Linux as my update server.
Download starts fine and downloads but gets to the last packet and then appears to time out - giving the "Error: SSL data read error" message around line 144 of the native_ota.c file
I've added to see where the problem occurs and it's always on the last read of the data from the server.
Same error, same place every time:
I've tried increasing the HTTP timeout to 30 seconds - same problem occurs.
Checking the logs on the download server, it's closing the connection after sending the last packet:
I can also download the file to my computer using HTTP so the server seems to be OK.
Digging deeper into the ESP32, esp_http_client_read is returning -ESP_ERR_HTTP_EAGAIN = -0x7007 (which is returned when call is timed-out before any data was ready) even though the last packet has been transmitted and received by the ESP32. It's just failing to detect that the stream has closed.
Any ideas?
Thanks
I'm trying to get the native_ota example from the Espressif IDE (5.3.1) to work.
Code compiles fine and runs.
I've got a PC running Linux as my update server.
Download starts fine and downloads but gets to the last packet and then appears to time out - giving the "Error: SSL data read error" message around line 144 of the native_ota.c file
Code: Select all
long read_counter=0;
while (1) {
read_counter++;
ESP_LOGI(TAG,"Packets read: %ld",read_counter);
snprintf(live_data.ota_status,60,"Packets read: %ld",read_counter);
int data_read = esp_http_client_read(client, ota_write_data, BUFFSIZE);
if (data_read < 0) {
ESP_LOGE(TAG, "Error: SSL data read error");
snprintf(live_data.ota_status,60,"Error: SSL data read error");
http_cleanup(client);
task_fatal_error();
} else if (data_read > 0) {
I've added
Code: Select all
read_counter
Same error, same place every time:
Code: Select all
I (19185) native_ota_example: Packets read: 873
I (19235) native_ota_example: Packets read: 874
E (24245) native_ota_example: Error: SSL data read error
E (24245) native_ota_example: Exiting task due to fatal error...
Checking the logs on the download server, it's closing the connection after sending the last packet:
Code: Select all
Header:
Version = TLS 1.2 (0x303)
Content Type = ApplicationData (23)
Length = 16408
Sent Record
Header:
Version = TLS 1.2 (0x303)
Content Type = ApplicationData (23)
Length = 13861
Sent Record
Header:
Version = TLS 1.2 (0x303)
Content Type = Alert (21)
Length = 26
Level=warning(1), description=close notify(0)
Digging deeper into the ESP32, esp_http_client_read is returning -ESP_ERR_HTTP_EAGAIN = -0x7007 (which is returned when call is timed-out before any data was ready) even though the last packet has been transmitted and received by the ESP32. It's just failing to detect that the stream has closed.
Any ideas?
Thanks