Repository navigation
fix(net): marshal esp_http_server route handlers onto the main task (#3588) + Xtensa link hotfix - #3597
Conversation
…3588) Route handlers used to execute ON the esp_http_server FreeRTOS task, running full fl::json/string/Response machinery concurrently with the main loop's fl:: churn. Requests are now marshaled: the httpd task extracts plain-C request data (method/uri/body buffers only), queues it, and blocks on a semaphore; the main task — via the existing task::Executor pump — runs the fl:: handler and hands back a heap-allocated Response the httpd task then serializes with IDF C APIs. No fl:: object is constructed or mutated off the main task. When the main loop is busy (e.g. a long bench test), requests get a clean 5xx instead of cross-task execution. Verified over the air (WROOM AP + C6 client): GET /ping 200 through the marshaled path. The #3588 corruption itself STILL reproduces even with handlers fully marshaled — which eliminates the last fl-object-cross-task theory; per-task stack watermarks (new heapCheck "tasks" field) show every task healthy under traffic, the RX ISR does no allocation, and heap integrity is intact seconds before the crash. Full record on the issue; next step is an IDF-source build with comprehensive heap poisoning. Also: - HOTFIX: #3596's pre-filter ISR telemetry broke the classic-ESP32 link ("l32r: literal placed after use" in the IRAM rxDoneCallback); the telemetry writes are now RISC-V-only. - heapCheck RPC reports per-task stack high-water marks. Host: 347/347, lint clean; esp32dev/c6/s3 compile clean. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds per-task stack headroom reporting to the AutoResearch heapCheck RPC, refactors the ESP32 asio HTTP server to marshal requests from the esp_http_server task to the main task via a queue/semaphore, and gates RMT RX channel 5 bench telemetry writes to RISC-V builds only. ChangesESP32 HTTP Server Request Marshaling
Diagnostics and platform-specific instrumentation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant HttpTask as esp_http_server task
participant Queue as Request Queue
participant MainTask as Main Task Runner
participant Handler as RouteHandler
Client->>HttpTask: HTTP request
HttpTask->>HttpTask: extract method/URI/body
HttpTask->>Queue: enqueue EspPendingRequest
HttpTask->>HttpTask: wait on semaphore
MainTask->>Queue: dequeue request
MainTask->>Handler: construct Request, invoke handler
Handler-->>MainTask: Response*
MainTask-->>HttpTask: signal semaphore
HttpTask->>Client: send HTTP response
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Main-task marshaling (#3588 hardening)
Route handlers used to execute ON the esp_http_server task, running full fl:: machinery concurrently with the main loop. Now: the httpd task extracts plain-C request data, queues it, and blocks on a semaphore; the main task (via the existing
task::Executorpump) runs the fl:: handler and returns a heapResponsethat the httpd task serializes with IDF C APIs. No fl:: object is constructed or mutated off the main task. Busy main loop → clean 5xx instead of cross-task execution.Verified over the air (WROOM AP ⇄ C6 client):
GET /ping200 through the marshaled path.Honest status: the #3588 corruption still reproduces even fully marshaled — eliminating the last fl-cross-task theory. New per-task stack watermarks (heapCheck
tasksfield) show all tasks healthy under traffic; RX ISR does no allocation; heap intact seconds before the crash. Next step documented on the issue: IDF-source build with comprehensive heap poisoning.Hotfix
#3596's pre-filter ISR telemetry broke the classic-ESP32 link (
l32r: literal placed after usein the IRAMrxDoneCallback) — telemetry writes now RISC-V-only. (Lesson: admin-merge + Xtensa IRAM = compile esp32dev before merging ISR-adjacent changes.)Host: 347/347; lint clean; esp32dev/c6/s3 compile clean.
Refs #3588.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes