"Task watchdog got triggered" with too many images, how to remedy? asynchronousWebServer

Error message

E (365249) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (365249) task_wdt: - async_tcp (CPU 0/1)
E (365249) task_wdt: Tasks currently running:
E (365249) task_wdt: CPU 0: IDLE0
E (365249) task_wdt: CPU 1: IDLE1
E (365249) task_wdt: Aborting.
abort() was called at PC 0x400ddad3 on core 0

Backtrace: 0x4008c434:0x3ffbe170 0x4008c665:0x3ffbe190 0x400ddad3:0x3ffbe1b0 0x40084771:0x3ffbe1d0 0x4014c107:0x3ffbc100 0x400dee83:0x3ffbc120 0x4008a361:0x3ffbc140 0x40088b7d:0x3ffbc160

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Setting AP (Access Point)…dhcps: send_nak>>udp_sendto result 0
AP IP address: 192.168.1.1
dhcps: send_offer>>udp_sendto result 0

As you can see in the program below, I tried adding vTaskDelay(10); in void loop as an attempt to solve the problem. Maybe it should be in other places?

The program works fine with less images. It just triggers the watchdog timer with more than 4-5 images. Is there a way to disable rebooting from the watchdog timer trigger?

#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <SPIFFS.h>

const char* ssid = "Wireless Controller";
const char* password = "12345678";


AsyncWebServer server(80);



void notFound(AsyncWebServerRequest *request)
{
    request->send(404, "text/plain", "Not found");
}


  
void action(AsyncWebServerRequest *request)
{
  Serial.println("ACTION!");

  int params = request->params(); // amount of params
  for (int i = 0; i < params; i++)
  {
    AsyncWebParameter* p = request->getParam(i);
    Serial.printf("POST[%s]: %s\n", p->name().c_str(), p->value().c_str());     
  }

  request->send(SPIFFS, "/index.html", String(), false);
}                   




IPAddress IP(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);






void setup()
{
   Serial.begin(115200);  // debugging
   Serial2.begin(9600, SERIAL_8N1, 16, 17); // Send data on pin 17
   delay(500);


  // Initialize SPIFFS
  if (!SPIFFS.begin(true))
  {
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }

  // Connect to Wi-Fi network with SSID and password
  Serial.print("Setting AP (Access Point)…");

  // Remove the password parameter, if you want the AP (Access Point) to be open
  WiFi.softAP(ssid, password);
  delay(2000);
  WiFi.softAPConfig(IP, gateway, subnet);
  IPAddress IP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(IP);




  // Route to load style.css file
  server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/style.css", "text/css");
  });







  // Index.HTML NAVIGATION BUTTIONS ************************************************


  server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/index.html", String(), false);
  });


  server.on("/action", HTTP_POST, action);




  // Pictures *****************************************************************


  server.on("/0all.png", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/0all.png", "image/png");
  });
  
  server.on("/1circle.png", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/1circle.png", "image/png");
  });

  server.on("/2fspiral.png", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/2fspiral.png", "image/png");
  });
  
  server.on("/3ped.png", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/3ped.png", "image/png");
  });

  server.on("/4clover.png", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(SPIFFS, "/4clover.png", "image/png");
  });




  server.onNotFound(notFound);

  server.begin();
  
}





void loop()
{
  // May not need once loop contains something:
  vTaskDelay(10); //https://github.com/espressif/arduino-esp32/issues/595

}

"You're doing too much in the HTTP callback."

Ok, then how do I remedy this problem?

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