-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Crash in AsyncWebSocket::textAll(String const&) #900
Comments
Iam experiencing the same issue. Sending char with text all every sec results in this exact same error and restart |
I'm starting to remove all ESPAsyncWebServer code from my project to replace it with espressif provided APIs, I see no future with this webserver if it keeps crashing all over the place after long runtimes, I need rock solid 24/7 ontime, seems like most arduino related library suffer of poor coding quality and bad memory management. In my investigations on this webserver library here I saw handwritten linked lists in a very strange coding style with callbacks and so on instead of using perfectly fine C++ provided containers. WTF. I am wondering how it kept working so good for so long in my development cycle so far |
Good for you! |
I'm just saying the problems could all have been avoided by not writing another container implementation, chances are very low to write a bug free version, c++ std library does a very good job at it with big comittee behind it, porting arduino containers over to std containers would fix crashes for everyone, im under time pressure to finish the project and therefore cannot do it right now |
My long journey of this crash finally found an end, I got rid of all the crashes 👍 |
Hey Daniel, And you know - I tried your version and wow - it actually decreases size of my binary on 9% (170k). Well it took me 30 minutes to switch from default gnu++11 to gnu++17 and still _queue = {} way to clear the queue does not work for me and was replaced with explicit constructors of empty queue, but... it works! I continue to test web server I have and so far it seems no features lost... I would need some time to switch back to async websocket again ) Also want to say that I verified if actual switch to c++17 helped with binary size - and no - it does not help... Thank you for efforts and decision to write here with your results. Also imo your memory management and threading improvements should be merged from your pull request for everybody for sure... |
Interesting thread. I may try out @0xFEEDC0DE64's port too. In defence to the custom linked-list argument, don't forget how much available DRAM is available on an ESP8266 so any short-cut helps in that area. I recently replaced a few of of the Arduino STL containers I was using in one of my projects with homegrown ones. I wrote a small sketch that loaded up 200 elements into a Also I used this port of AsyncWebServer https://github.com/sascha432/ESPAsyncWebServer which saves an additional 2K by moving all strings to Flash/PROGMEM. For ESP32 only check out https://github.com/fhessel/esp32_https_server |
I am very interested in any fixes to the stability of this webserver. So, in order to do some code review/cleanup, and also to make the code compatible with the default C++11 setup in Arduino/ESP32, I went through every patch in the dumbfixes branch of @0xFEEDC0DE64 . The result is here: yuboxfixes-0xFEEDC0DE64-cleanup. Besides making the patches C++11 compatible, I wanted to lay out every single fix and understand why each one of them was necessary. I am performing a torture test right now with the yuboxfixes-0xFEEDC0DE64-cleanup branch, and it has not crashed once yet in 3 hours so far (previous attempts crashed with various memory corruption backtraces). |
@avillacis thanks for doing that! Have you noticed any differences other than the web-socket stability, such as changes in the memory heap used or firmware/sketch size? |
I have not checked RAM usage, but the firmware file is 1025344 bytes before the changes by @0xFEEDC0DE64 , and 1026064 after. |
I'm not sure if I missed something obvious, but I can't compile using the commit referenced here. Please could you outline any changes that are needed to use this branch. Here are some of the issues I ran into - there were a lot of compile errors, so I assume something else needs doing and not just adding the git url to my platformio.ini file. h2zero/NimBLE-Arduino#167 (comment) |
Kudos to @0xFEEDC0DE64 for the patch and @avillacis for the code cleanup! Here's the test code:
|
i have the same issue here. The crash is random and unpredictable. |
Any progress on this issue? I am finding it easy to reproduce using textAll to send small websocket messages (approx 35-40 bytes) to a client, at approximately 5hz (200ms delay between messages), after about five minutes the ESP32 will crash with a corrupt heap error. |
I completely ditched the ESPAsyncWebserver from my project and started using the espressif provided httpd, which also forced to ditch platformio for the esp-idf, and since them I have never encountered any bugs or any problems anymore. The refactoring was huge to switch to the C apis from espressif but was worth all the efforts :) |
@0xFEEDC0DE64 and @avillacis, thanks for the reworked library. It's a pity the official repo is outdated and not taking pull request anymore. @avillacis, would you mind enabling issues in your repo, so as to keep the library evolving somewhere? I have tried to test the library but it seems that the class AsyncWebSocketMessageBuffer has been removed. |
Wrapper class for PZEM004T/PZEM004Tv30 libs, controlled with USE_PZEMv3 definition Note: Async Server has lot's of issues under esp32 me-no-dev/ESPAsyncWebServer#876 me-no-dev/ESPAsyncWebServer#900 espressif/arduino-esp32#1101 me-no-dev/ESPAsyncWebServer#324 me-no-dev/ESPAsyncWebServer#932 Signed-off-by: Emil Muratov <gpm@hotplug.ru>
[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. |
Sorry for the late reply. I have been busy with work. Issues on the fork are now enabled.
As commented in branch |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
@0xFEEDC0DE64 and @avillacis (and others) many thanks for this improved fork! I've found it to be a tremendous improvement in stability with websockets. I hope other people will find this post earlier than I did. |
[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. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
After a few hours of uptime and lots of calls to textAll, it sometimes crashes with the following stack:
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
The text was updated successfully, but these errors were encountered: