From b7e2ccffc17e540ef01e1d004985f7272c339e19 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 12 Feb 2026 14:33:01 +0200 Subject: [PATCH 1/2] Revert "audio: set HTTP stream timeout after connect" This reverts commit 37192642e58e9f8dc90a3babae96a8889066d788. The change was an attempt to fix the following issue reported by a user: I (10:37:32.526) WILLOW/AUDIO: AUDIO_REC_WAKEUP_END I (10:37:32.542) WILLOW/AUDIO: WIS HTTP client HTTP_STREAM_POST_REQUEST, write end chunked marker E (10:37:34.547) transport_base: esp_tls_conn_read error, errno=No more processes I (10:37:34.548) WILLOW/AUDIO: WIS HTTP client HTTP_STREAM_FINISH_REQUEST E (10:37:34.562) WILLOW/AUDIO: WIS response took longer than 2000ms, connection aborted Unfortunately this change didn't fix the bug. The problem is that something changed between the ESP components in 0.3.* and 0.4.*, and this particular problem happens only when using WIS over TLS. As the change doesn't fix anything, revert it. --- main/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/audio.c b/main/audio.c index 7267f80c..41926834 100644 --- a/main/audio.c +++ b/main/audio.c @@ -556,7 +556,6 @@ static esp_err_t hdl_ev_hs_to_api(http_stream_event_msg_t *msg) return ESP_OK; case HTTP_STREAM_ON_REQUEST: - esp_http_client_set_timeout_ms(http, HTTP_STREAM_TIMEOUT_MS_POST_REQUEST); wlen = sprintf(len_buf, "%x\r\n", msg->buffer_len); if (esp_http_client_write(http, len_buf, wlen) <= 0) { return ESP_FAIL; @@ -573,6 +572,7 @@ static esp_err_t hdl_ev_hs_to_api(http_stream_event_msg_t *msg) case HTTP_STREAM_POST_REQUEST: ESP_LOGI(TAG, "WIS HTTP client HTTP_STREAM_POST_REQUEST, write end chunked marker"); + esp_http_client_set_timeout_ms(http, HTTP_STREAM_TIMEOUT_MS_POST_REQUEST); if (esp_http_client_write(http, "0\r\n\r\n", 5) <= 0) { return ESP_FAIL; } From 9694d781b0178fd8ec25c5a18a0ded377e11142d Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 12 Feb 2026 16:09:27 +0200 Subject: [PATCH 2/2] audio: rework HTTP timeout behaviour Something between ESP-IDF v5.1.1 and 5.3.3 changed that causes the 10s timeout we set in the HTTP_STREAM_POST_REQUEST callback to be ignored when using HTTPS. Due to this, people with slower WIS cannot use Willow 0.4 anymore. Set the timeout to 10s in HTTP_STREAM_PRE_REQUEST to not use the ESP-ADF http_stream hardcoded default of 30s. If WIS is not running, or the user configured a wrong IP or port, the transport layer detects the problem early anyway. --- main/audio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main/audio.c b/main/audio.c index 41926834..1fbb6012 100644 --- a/main/audio.c +++ b/main/audio.c @@ -59,8 +59,7 @@ #define DEFAULT_WIS_TTS_URL "https://infer.tovera.io/api/tts" #define DEFAULT_WIS_URL "https://infer.tovera.io/api/willow" -#define HTTP_STREAM_TIMEOUT_MS 2 * 1000 -#define HTTP_STREAM_TIMEOUT_MS_POST_REQUEST 10 * 1000 +#define HTTP_STREAM_TIMEOUT_MS 10 * 1000 #define MULTINET_TWDT 30 #define STR_WAKE_LEN 25 @@ -225,9 +224,6 @@ static esp_err_t hdl_ev_hs_esp_audio(http_stream_event_msg_t *msg) esp_http_client_set_authtype(http, HTTP_AUTH_TYPE_BASIC); esp_http_client_set_timeout_ms(http, HTTP_STREAM_TIMEOUT_MS); break; - case HTTP_STREAM_POST_REQUEST: - esp_http_client_set_timeout_ms(http, HTTP_STREAM_TIMEOUT_MS_POST_REQUEST); - break; default: break; } @@ -572,7 +568,6 @@ static esp_err_t hdl_ev_hs_to_api(http_stream_event_msg_t *msg) case HTTP_STREAM_POST_REQUEST: ESP_LOGI(TAG, "WIS HTTP client HTTP_STREAM_POST_REQUEST, write end chunked marker"); - esp_http_client_set_timeout_ms(http, HTTP_STREAM_TIMEOUT_MS_POST_REQUEST); if (esp_http_client_write(http, "0\r\n\r\n", 5) <= 0) { return ESP_FAIL; } @@ -589,7 +584,6 @@ static esp_err_t hdl_ev_hs_to_api(http_stream_event_msg_t *msg) if (http_status != 200) { // when ESP HTTP Client terminates connection due to timeout we get -1 if (http_status == -1) { - ESP_LOGE(TAG, "WIS response took longer than %dms, connection aborted", HTTP_STREAM_TIMEOUT_MS); ui_pr_err("WIS timeout", "Check server performance"); } else if (http_status == 401) { ESP_LOGE(TAG, "WIS returned Unauthorized Access (HTTP 401)");