fix(llm_proxy): exempt task from TWDT during blocking HTTP call - #182
fix(llm_proxy): exempt task from TWDT during blocking HTTP call#182primalkz wants to merge 1 commit into
Conversation
- prevents reboot when HTTP call blocks up to 120s - covers both direct and proxy paths - guards against phantom subscription if task was not previously subscribed
📝 WalkthroughWalkthroughThis PR adds Task Watchdog Timer (TWDT) protection to blocking HTTP operations in ChangesTask Watchdog Protection for Blocking HTTP Operations
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
@IRONICBo Would appreciate a review. Without this fix using local LLMs or models with slow inference times causes reboot mid gen, wasting tokens and breaking the session. |
Summary
Fixes WDT-triggered hard resets during slow LLM responses. Removes the task from TWDT monitoring for the duration of the blocking HTTP call, on both the direct and proxy paths.
Problem
Calling
esp_task_wdt_reset()before and afteresp_http_client_perform()does not work. A task parked in a locking call cannot execute any code, watchdog resets.Ask MimiClaw to summarize a long document. The LLM accepts the connection but takes 18s to generate the response. The TWDT fires at t=5s the call,
abort()is called, and the chip resets cold. The user sees startup blink sequence mid-conversation, session gone. UART shows rst:0xc (SW_CPU_RESET)`. The post-call reset never executes.Fix
esp_task_wdt_delete(NULL)removes the calling task from TWDT monitoring the blocking call.esp_task_wdt_add(NULL)andesp_task_wdt_reset()restore it after.wdt_was_subscribedguards against accidentally subscribing the task if it was not previously registered. Applied to bothllm_http_directandllm_http_via_proxy.Validation
rst:0xc. With this fix the response completed in 23 s without a reset.Summary by CodeRabbit