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

Page not loading #185

Closed
frippan opened this issue Dec 13, 2023 · 3 comments
Closed

Page not loading #185

frippan opened this issue Dec 13, 2023 · 3 comments
Assignees

Comments

@frippan
Copy link

frippan commented Dec 13, 2023

When I try to load the page I only get the Logo on the top and Connected down in in corner. All the tabs are gone. Sometimes it could work but often no. Was thinking if that's a heap issue?

The page I load is pretty big, can that be an issue?

I have a bit over 100 cards on the page.

I'm using the latest pro version but had the same problem with the old 4.0.2 from september

I don't get any error in the console in chrome.

@mathieucarbou
Copy link
Contributor

mathieucarbou commented Dec 13, 2023

Hello,

You are running into the same issue as I did.

The library is using String, which, when reserving more space for copy, will invalidate themselves if the memory cannot be allocated, and then an empty string gets sent to the websocket channel, which blanks the page (I might mistaken but that's what my analysis concluded while debugging).

You can add these lines in the code to debug and see your approximate payload size:

https://github.com/ayushsharma82/ESP-DASH/pull/182/files#diff-b22c24b3d761e54f8997b5313d563e3b2b58217a99f7e9e95beb68ad19ba6e13R331-R333

I suggest you set DASH_LAYOUT_JSON_SIZE to a multiple of 4k greater than your payload size.

If you look at all my Prs, I did 2 of them regarding memory footprint improvements: you can try merging in your fork, in order:

  1. Combination of 1+2+3+4+5+6 + websocket reload fix #183
  2. 5. Reducing payload size #184

My PRs fixe a lot of issues (including the wrong refresh after uploading firmware, component ids, etc) and also add another flag regarding memory control: DASH_PARTIAL_UPDATE_JSON_SIZE.

The idea is to set DASH_LAYOUT_JSON_SIZE to a value greater than the initial payload size when the layout refreshed entirely and then after set DASH_PARTIAL_UPDATE_JSON_SIZE to a value matching the size of your partial updates (same, 4k multiple and greater than.


The important key idea is to make the String buffer allocate enough memory so that it does not have to re-allocate and do not need to do a String copy, which would temporary require twice the amount of memory needed.

It is better to also use dahboard.update() and not force a full refresh each time.

@frippan
Copy link
Author

frippan commented Dec 18, 2023

Thanks, I have been using it for a couple of days now and everything looks good.

@frippan
Copy link
Author

frippan commented Dec 18, 2023

Closed

@frippan frippan closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants