Skip to content

ESP32-S3: HTTPD task stack overflow during Music Assistant playback; increasing config.stack_size appears to resolve #102

Description

@jonlove234

Summary

I'm seeing reproducible crashes on an ESP32-S3 running the SendSpin ESP integration. The crash is a FreeRTOS stack overflow in the httpd task.

The overflow occurs while streaming from Music Assistant. Increasing the HTTP server task stack from the ESP-IDF default to 16 KB appears to eliminate the crash (testing is still ongoing).

Environment
sendspin-cpp: 0.7.0 (bundled with ESPHome)
ESPHome: 2026.7.3
ESP-IDF: 5.5.5
Music Assistant: 2.9.9
MCU: ESP32-S3
Symptoms

Before every crash I consistently see protocol warnings such as:

W (...) sendspin.protocol: Ignoring field 'track_duration': expected integer in [0, 4294967295]
A few minutes later:

***ERROR*** A stack overflow in task httpd has been detected.
The decoded backtrace is:

panic_abort
esp_system_abort
vApplicationStackOverflowHook
vTaskSwitchContext

The overflowing task is explicitly reported as httpd.

Investigation

SendspinWsServer::start() creates the HTTP server using:

httpd_config_t config = HTTPD_DEFAULT_CONFIG();
The code customizes several fields (task_priority, ports, callbacks, etc.) but leaves config.stack_size at the ESP-IDF default.

As a test, I modified src/esp/ws_server.cpp to set:

httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.stack_size = 16384;

After rebuilding and flashing, the device successfully:

starts the HTTP server
accepts SendSpin connections
completes the WebSocket handshake
connects to Music Assistant

and, so far, has not reproduced the previously frequent stack overflow. I'm continuing longer-term testing.

Question

Has anyone else observed HTTPD stack overflows on ESP32-S3 or with newer ESP-IDF versions?

If not, would it make sense to increase the default HTTPD task stack (or make it configurable) for the ESP implementation? It seems the current default may no longer provide enough headroom under real-world protocol handling.

I'm happy to provide additional logs or test proposed changes if that would be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions