fix(esp_http_server): prevent silent message drop in httpd_queue_work

Closes https://github.com/espressif/esp-idf/issues/18563
This commit is contained in:
Ashish Sharma
2026-06-05 17:34:30 +08:00
parent a8d5fc0e3f
commit 70faf553a4
4 changed files with 116 additions and 36 deletions
+12 -3
View File
@@ -53,9 +53,18 @@ menu "HTTP Server"
config HTTPD_QUEUE_WORK_BLOCKING
bool "httpd_queue_work as blocking API"
help
This makes httpd_queue_work() API to wait until a message space is available on UDP control socket.
It internally uses a counting semaphore with count set to `LWIP_UDP_RECVMBOX_SIZE` to achieve this.
This config will slightly change API behavior to block until message gets delivered on control socket.
Selects the wait policy for httpd_queue_work() when the UDP control-socket
mbox is at capacity. The HTTP server always uses a counting semaphore
(sized to LWIP_UDP_RECVMBOX_SIZE) to prevent silent mbox overflow drops
that would leak the caller's async-send callback context.
When disabled (default): httpd_queue_work() returns ESP_FAIL immediately
if the mbox is full, so the caller can free its callback context. This
preserves the non-blocking semantics of httpd_ws_send_data_async().
When enabled: httpd_queue_work() blocks until a slot is available. Use
this only if your application can tolerate the call blocking and wants
guaranteed delivery instead of a fast-fail.
config HTTPD_ENABLE_EVENTS
bool "Enable ESP_HTTP_SERVER_EVENT"