From 4d404f530132e01d37ac0ee2ecfc9986dc3a3e21 Mon Sep 17 00:00:00 2001 From: "Valentin V. Bartenev" Date: Wed, 6 May 2026 21:58:57 +0300 Subject: [PATCH] Web: align page chunk size to MBEDTLS_SSL_OUT_CONTENT_LEN to fix WDT reboot The hardcoded kWebPageChunkSize of 768 bytes caused the task watchdog to trigger when serving the web panel over HTTPS. Each call to httpd_resp_send_chunk() results in a separate TLS record encryption via mbedTLS, which on ESP32-S3 uses DMA-backed AES-GCM (esp_aes_process_dma). The gdma_disconnect() call inside that path enters a critical section, blocking the IDLE0 task. With 768-byte chunks, a large page response requires many such DMA operations in tight succession, starving the IDLE task long enough to trip the watchdog. Replacing the hardcoded value with MBEDTLS_SSL_OUT_CONTENT_LEN aligns the chunk size to the TLS output record buffer, minimising the number of TLS records (and thus DMA encryption operations) needed to send a full page, and keeping the httpd task within the watchdog timeout. Fixes: task_wdt abort in sendProgmemChunked() -> httpd_ssl_send() -> esp_aes_process_dma() -> gdma_disconnect() on ESP32-S3. --- src/helpers/web/WebPanelServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/web/WebPanelServer.cpp b/src/helpers/web/WebPanelServer.cpp index 737a0a79..367c406e 100644 --- a/src/helpers/web/WebPanelServer.cpp +++ b/src/helpers/web/WebPanelServer.cpp @@ -26,7 +26,7 @@ constexpr size_t kWebCommandBufferSize = 192; constexpr size_t kWebReplyBufferSize = 256; constexpr size_t kWebStatsQueryBufferSize = 96; constexpr size_t kWebStatsReplyBufferSize = 4608; -constexpr size_t kWebPageChunkSize = 768; +constexpr size_t kWebPageChunkSize = MBEDTLS_SSL_OUT_CONTENT_LEN; constexpr unsigned long kWebIdleTimeoutMs = WEB_PANEL_IDLE_TIMEOUT_MS; #if defined(MQTT_DEBUG) && MQTT_DEBUG