ayushsharma82 / ESP-DASH

Blazing fast library to create a functional dashboard for ESP8266 / ESP32
https://espdash.pro
GNU General Public License v3.0
976 stars 200 forks source link

Crash when loading UI when sendUpdate is part of a task #151

Closed skarfacegc closed 3 months ago

skarfacegc commented 1 year ago

I have a task that handles gathering the data that I want to show on the dashboard. Whenever I call sendUpdate I get a LoadProhibited error. Any idea where I should be looking?

SDK 4.43 ESP32 using platformio with everything updated (not sure it's actually current versions of everything)

skarfacegc commented 1 year ago

moving sendUpdate out of my task and into the main loop seems to have worked, just needed to add a vTaskDelay to the main loop. If I had passed dashboard into the task via params, would that have worked as well?

skarfacegc commented 1 year ago

So, there's definitely something going on here. When I move send update into the task that is issuing the card.update I start to get crashes immediately after the dashboard loads. Looks like it crashes on the first post load sendUpdate?

Moving sendupdate from main loop to this line breaks things. https://github.com/skarfacegc/Probeinator/blob/b6d99cec3c06d846e662dd320c99dc3e1c1467a0/src/main.cpp#L189

This seems to be working fine when I put sendUpdate in the main loop.
Crashes look like what I pasted below. Done a ton of dev in my life, very little C. This may come down to I don't understand scoping well enough, but I /think/ I've dug through most of that.

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4010cf3b  PS      : 0x00060834  A0      : 0x8010bee6  A1      : 0x3ffd3b10  
A2      : 0x3ffc5e20  A3      : 0x00000000  A4      : 0x0000ffff  A5      : 0x00000000  
A6      : 0x3f41bf50  A7      : 0x00000070  A8      : 0x00000002  A9      : 0x3ffd3a80  
A10     : 0x00000374  A11     : 0x9ad29925  A12     : 0x9ad29925  A13     : 0x3ffc5e78  
A14     : 0x00000354  A15     : 0x00000004  SAR     : 0x00000000  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00010047  LBEG    : 0x40089678  LEND    : 0x4008968e  LCOUNT  : 0xffffffff 
skarfacegc commented 1 year ago

sorry. I suck at github.

skarfacegc commented 1 year ago

Trying this again.

ayushsharma82 commented 1 year ago

Hi @skarfacegc,

Internally the sendUpdate function broadcasts data ( more than 10KB depending on how much cards you have on dashboard ) to all websocket clients. You may have low memory allocated for that particular task which causes the ESP to crash.

You can try increasing this value to something like 10240: https://github.com/skarfacegc/Probeinator/blob/b6d99cec3c06d846e662dd320c99dc3e1c1467a0/src/main.cpp#L225

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you are still facing the problem, please tag the author of repository and state your concern.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 months ago

This issue was closed because it has been stalled for 5 days with no activity.