arduinoWebSockets icon indicating copy to clipboard operation
arduinoWebSockets copied to clipboard

Heap memory problem when wifi is cut off of internet

Open shrynshjn opened this issue 4 years ago • 0 comments

I am using socket.io client to connect to my server using websockets. It works fine as long as the internet connection is there, but if i disable the internet keeping the wifi on It starts consuming heap, and also each websocket loop takes more time. I am not sure if its an issue with the library or a core esp8266 issue.

Time and heap before websocket run: 1120862, 38680 Time and heap after websocket run: 1126359, 38680 Time and heap before wifi run: 1126360, 38680 Time and heap after wifi run: 1126360, 38680 Time and heap before websocket run: 1126361, 38680 Time and heap after websocket run: 1136584, 38680 Time and heap before wifi run: 1136584, 38680 Time and heap after wifi run: 1136584, 38680 Time and heap before websocket run: 1136586, 38680 Time and heap after websocket run: 1142083, 38680

heap decrease and time increase happens at different times, I did confirm that heap decreases when I make a call to websocket.loop() inside my code. As you can see the time difference is about 6s in the iteration I copied here, it increases with time. using arduinoWebSockets 2.3.1 esp8266Core 2.5.0

The websocket client is also not diconnecting for a long time, even though the internet connection is closed and its only connected to a router. Interestingly this doesnt happen if a socket connection was never formed, or if the device router is shut down. Any guidance to how to solve this heap loss problem will be appreciated.

shrynshjn avatar Apr 22 '21 08:04 shrynshjn