Yet another wdt reset when using ESPAsyncWebServer

I'm aware it's a known issue, but I'm not able to fix it.
In the short term, I'll happy with a working workaround.

In my sketch I added:

#undef CONFIG_ASYNC_TCP_USE_WDT
#define CONFIG_ASYNC_TCP_USE_WDT 0

void setup() 
{
    disableCore0WDT();
    disableCore1WDT();
    disableLoopWDT();
    // ...

but still when a web page is requested the wdt is triggered. Not always, but it happens.
I'm using ESPAsyncWebServer (latest release).

How is it possible it triggers a wdt reset if I disabled it?

It's impossible to help you given the amount of information you've provided.

Start by telling us which Arduino board you're using.

Then, post an MRE. This is the smallest possible complete code that compiles and demonstrates the problem at hand, and only that problem. Leave out any messy clutter code that's not related to the problem. Your example code should also not require any special hardware connected to the Arduino and should use the smallest possible number of external libraries.

I'm using an ESP32 with the Arudino framework, not a commercial Arduino board.
It's almost impossible to provide a complete example that demostrates the issue. If I was able to do that I will solved the issue by myself.

I try to rephrase my question:

"how is it possible that any part of the code triggers a wdt reset if the wdt has been disabled?"

I'm sorry if it was not so clear, but I'm not asking you to solve the AsyncWebServer issue, but if I need to add other code to prevent any wdt reset.

My guess is that these functions don't really do what you think they do:

    disableCore0WDT();
    disableCore1WDT();

Their description is rather cryptic, but in esp32-hal-misc.c:

void enableCore0WDT(){
    TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCPU(0);
    if(idle_0 == NULL || esp_task_wdt_add(idle_0) != ESP_OK){
        log_e("Failed to add Core 0 IDLE task to WDT");
    }
}

void disableCore0WDT(){
    TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCPU(0);
    if(idle_0 == NULL || esp_task_wdt_delete(idle_0) != ESP_OK){
        log_e("Failed to remove Core 0 IDLE task from WDT");
    }
}

And, in esp_task_wdt.h:

/**
  * @brief  Unsubscribes a task from the Task Watchdog Timer (TWDT)
  *
  * This function will unsubscribe a task from the TWDT. After being
  * unsubscribed, the task should no longer call esp_task_wdt_reset(). If the
  * task is an IDLE task, this function will automatically disable the calling
  * of esp_task_wdt_reset() from the Idle Hook. Calling this function whilst the
  * TWDT is uninitialized or attempting to unsubscribe an already unsubscribed
  * task from the TWDT will result in an error code being returned.
  *
  * @param[in]  handle  Handle of the task. Input NULL to unsubscribe the
  *                     current running task.
  *
  * @return
  *     - ESP_OK: Successfully unsubscribed the task from the TWDT
  *     - ESP_ERR_INVALID_ARG: Error, the task is already unsubscribed
  *     - ESP_ERR_INVALID_STATE: Error, the TWDT has not been initialized yet
  */
esp_err_t esp_task_wdt_delete(TaskHandle_t handle);

Additionally, if you set the Core Debug Level to something other than "None" when you run the code, you'll see:

[  3493][E][esp32-hal-misc.c:143] disableCore1WDT(): Failed to remove Core 1 IDLE task from WDT

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.