me-no-dev / ESPAsyncWebServer

Async Web Server for ESP8266 and ESP32
3.61k stars 1.17k forks source link

esp32 crash when wifi lost #1205

Open Vorms opened 1 year ago

Vorms commented 1 year ago

Hello, When the disconnect event arrive, I try to close the socket: void removeClient(){ char buf[200]; if (isClientToBeRemoved){ if (clientsMap.find(itForRemove->second.id) != clientsMap.end()){ if (itForRemove->second.client->status() == WS_CONNECTED){ itForRemove->second.client->close();
} else {

ifdef DEBUG

    Serial.printf("Le websocket: %ld est déja déconnecté!\r\n", itForRemove->second.id);

endif

  }

The crash debugger: Decoding stack results 0x4016e38f: AsyncClient::space() at F:\users\Vorms\Documents\Arduino\libraries\AsyncTCP-master\src\AsyncTCP.cpp line 742 0x400e6b01: AsyncClient::canSend() at F:\users\Vorms\Documents\Arduino\libraries\AsyncTCP-master\src\AsyncTCP.cpp line 1154 0x400de4f4: AsyncWebSocketClient::_queueControl(AsyncWebSocketControl) at F:\users\Vorms\Documents\Arduino\libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp line 564 0x400de591: AsyncWebSocketClient::close(unsigned short, char const) at F:\users\Vorms\Documents\Arduino\libraries\ESPAsyncWebServer-master\src\AsyncWebSocket.cpp line 590 0x400d49b9: removeClient() at F:\users\Vorms\Documents\Arduino\Ne202_auto_connect_new/Ne202_auto_connect_new.ino line 739 0x400d8174: loop() at F:\users\Vorms\Documents\Arduino\Ne202_auto_connect_new/Ne202_auto_connect_new.ino line 598 0x400e9961: loopTask(void*) at F:\users\Vorms\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.6\cores\esp32\main.cpp line 23 0x4008ec4e: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

Please keep me in touch !!!

Best regards Thierry Vorms

zekageri commented 1 year ago

If the socket disconnected you can not close it because it was destroyed earlier. That is the crash

Vorms commented 1 year ago

Hoh thanks a lot for your response! Your library is very good, but, may be you can publish that in case of disconnect th ws is destroy! For me it was very difficult to find !

Best regards Thierry Vorms Le mar. 6 sept. 2022 00 h 50, DrRandom @.***> a écrit :

If the socket disconnected you can not close it because it was destroyed earlier. That is the crash

— Reply to this email directly, view it on GitHub https://github.com/me-no-dev/ESPAsyncWebServer/issues/1205#issuecomment-1237655973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6QD4OPMWPSTIOZUCOBDF3V43EPZANCNFSM6AAAAAAQFJ3BUI . You are receiving this because you authored the thread.Message ID: @.***>

stale[bot] commented 1 year ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.