-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
ESP32: Memory leak when continuously sending data to client #2014
Comments
This is likely due to multithreading issues and races. For the ESP32 we will need to rewrite the |
Are these issues specific to our integration of esp-idf or should/could we raise this to upstream with some more generic statement? They're discussing the symptom |
They're specific to our |
Agree, the statements there are pretty clear http://git.savannah.nongnu.org/cgit/lwip.git/tree/doc/rawapi.txt#n31 Which options do we have now?
|
The netconn API does have some event callback functionality, and claims to also do nonblocking, so I think it should be possible to use it as the foundation instead. |
Right, there's a callback for the application, missed that. Though things are quite specific to fit the needs of the socket API. Will have a look. |
It would probably be worth to merge in https://github.com/jmattsson/nodemcu-firmware/tree/esp32-net-accept-race as band-aids in the interim. I also wanted to change from |
It took me some time to get my head around lwip and netconn, but there's a working prototype now at https://github.com/devsaurus/nodemcu-firmware/tree/esp32-netconn. And for the good news: It passes my server stress test with
Reading through the lwip code I found several statements related to the general accept & receive race we also have in #1970. Not sure yet how this corner case is addressed exactly on netconn level and whether we'd benefit instantly, but I'll give it a try as soon as I have a suitable test case setup. |
Great effort, cheers! |
@devsaurus Uploaded latest changes for developers-esp32 and after make all get the error messages:
What happened? |
@devsaurus If enable the module U8G2 all compiles without errors. But I don't need it in this project. |
@devsaurus Began testing his WWW server with a new API. Noticed some peculiar behavior.
And despite the arising problems (compared to the old API) this version is much better. Thank you for your work! |
@devsaurus After an error |
@LDmitryL please open a new issue for your observations and attach your Lua code so I can try to reproduce and investigate. |
Expected behavior
I have some server code scripts that send data to a client which work without memory problems on the current esp8266 firmware.
Actual behavior
When running the same code on
dev-esp32
heap decreases constantly and at some point the wifi disconnects from the AP. Symptoms are similar to what @LDmitryL reported here #1970 (comment), but I don't think it's actually related to #1970 for following reasons:Test code
I tried to isolate the problem, but can't reproduce it in any artificial test case other than my vnc server framework. I've set up a
debug
branch which will output some diagnostic messages at https://github.com/devsaurus/nodemcu-vncserver/tree/debug.Steps to reproduce:
wifi
,net
,bit
,struct
vncserver.lua
andrectangles.lua
to ESP32.dofile("rectangles.lua")
vncviewer <ip_of_esp32>
NodeMCU version
dev-esp32
branch.Hardware
ESP32 board.
The text was updated successfully, but these errors were encountered: