Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webSocket.binaryAll sending ESP32-Cam data Buffer/Memory issues? #820

Closed
cgmckeever opened this issue Aug 6, 2020 · 6 comments
Closed
Labels

Comments

@cgmckeever
Copy link

Im pretty sure I am just slamming out the buffer/memory, but I am not sure how to throttle it. I've gone deep through issues and google but I havent come up with the solution. Is thee a way to check that a binaryAll has completed and do any clean up before sending the next? I tried adding a timer, but I still get crashes as 500ms - and even when it slightly works, the delay on the feed is bad.

 abort() was called at PC 0x4016063b on core 0
camera_fb_t *fb = NULL;

...

void loop() {
   fb = esp_camera_fb_get();
   webSocket.binaryAll(fb->buf, fb->len);
   esp_camera_fb_return(fb);
}
@cgmckeever
Copy link
Author

I found part of a solution, it makes it tolerable, but not perfect

@cgmckeever
Copy link
Author

related

PC: 0x400d2069: loop() at /Users/cgmckeever/Documents/Arduino/libraries/ESPAsyncWebServer/src/StringArray.h line 88
EXCVADDR: 0xbaad567c

Decoding stack results
0x400d2069: loop() at /Users/cgmckeever/Documents/Arduino/libraries/ESPAsyncWebServer/src/StringArray.h line 88
0x400e7b75: loopTask(void*) at /Users/cgmckeever/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/cores/esp32/main.cpp line 19
0x4008dd75: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

@cgmckeever
Copy link
Author

Also this PR helps with resolution

@stale
Copy link

stale bot commented Oct 7, 2020

[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 stale bot added the stale label Oct 7, 2020
@stale
Copy link

stale bot commented Oct 21, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Oct 21, 2020
@un0038998
Copy link

I faced the similar issues with AsyncWebSocket when sending huge data continuously .
I was sending binary image from esp32 cam board and each image was 5Kb .
So when we keep sending messages , the queue gets full if connection is slow or receiver is slow.
Then It consumes whole heap memory available for esp32 board (max heap available around 180kb) .
So I changed the WS_MAX_QUEUED_MESSAGES parameter to 15 from 32. So the max messages queued will have the total size of 15*5kb = 75kb which is much less than total heap .
It resolved the issue for me and it never crashed again .
You can change this setting in AsyncWebSocket.H file in the library folder.

Check the size of the messages you are sending and set this parameter so that it does not exceed total heap memory.
Hope this might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants