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.
This commit is contained in:
Valentin V. Bartenev
2026-05-06 21:58:57 +03:00
rodzic 2f69718cfe
commit 4d404f5301
+1 -1
Wyświetl plik
@@ -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