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

Does card-mod.js have a memory leak? #413

Open
CodeOptimist opened this issue Nov 13, 2024 · 12 comments
Open

Does card-mod.js have a memory leak? #413

CodeOptimist opened this issue Nov 13, 2024 · 12 comments

Comments

@CodeOptimist
Copy link

CodeOptimist commented Nov 13, 2024

My Home Assistant browser has been running out of memory for months. After trying to fix this for half a year or longer, I found this topic: https://community.home-assistant.io/t/out-of-memory-error-in-browser/704262

I uninstalled card-mod, refreshed with Ctrl+F5 and the problem is finally fixed. I make lots of use of auto-entities (awesome, appreciate your work Thomas). But I actually had nothing using card-mod on any of my dashboards, it was merely installed as visible in the Developer Tools console.

I also had it installed as a frontend module:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js

In configuration.yaml

It was not a browser extension causing it either, as I tested first in Incognito (with only a couple still running) but then recently in Chrome's "Guest" mode with 0 extensions running, and the problem persisted. Now it finally seems solved with card-mod removed. No slowdowns. I've made no other changes.

Could still be a coincidence/something-else, or a HA bug, or a Chrome bug, or who knows what!

(I had v3.4.3.)

Oh and the major symptom of this issue before it eventually runs out of memory and crashes the browser tab, is things become extremely slow on the Dashboard. (Which might match other bug reports.)

I have my HA tab open 100% of the time on a dedicated monitor, always visible (never a "background tab"), so that might make me experience this issue sooner than others... though this doesn't seem like an uncommon setup? It takes about a day (or two) to become noticeably slow to respond, and crashes after a week-ish if I don't refresh.

@CodeOptimist CodeOptimist changed the title Does card-mod have a memory leak? Does card-mod.js have a memory leak? Nov 13, 2024
@pluusla
Copy link

pluusla commented Nov 15, 2024

I also believe that card-mod is causing a problem here.

I notice a lot of memory consumption here too:
image

As well as in the browser console after some time (when tab is open) the following error messages:
image

Uncaught (in promise) {code: 'not_found', message: 'Subscription not found.'} card-mod.js:1 Uncaught (in promise) y @ card-mod.js:1 s @ card-mod.js:1

After a certain time, the dashboard becomes slow and some functions, such as closing the bubble card pop-up, no longer work.

@SmartHomeFanatic
Copy link

Same here. Tab with HA became unresponsive after a while. Removed card-mod and everything is working smooth again.

@ildar170975
Copy link
Contributor

What cards are you using it with?
If with mushrooms - note that the mushroom cards’ author does not recommend using card-mod with them.

@pluusla
Copy link

pluusla commented Nov 18, 2024

I have mushroom cards in use, but do not use card mod styling with them. I only need card mod for one theme (Material Rounded). Otherwise I don't use any styling with Card-Mod.

@arrikhan
Copy link

There is anecdotal evidence around (reddit etc) that just loading card mod causes this memory leak issue. I run HA in edge and chrome side by side and I see both the CPU churning at 10%+ for the tabs and the memory continuously climbing on both browsers. Am happy to play around and dig out data if someone can point me to what would be useful to help resolve this.

@whittssg
Copy link

whittssg commented Nov 28, 2024

I am pretty sure there is a leak with 3.4.3 as well. I recently swapped a wall tablet out from a fire tablet to a leveno and since this is a more powerfull device I decided to use lovelace (vs homehabit that i had on the fire tablet). Anyway after an hour or two the tablet would be back on the home screen (i tried with home assistant app and kiosk). I also always leave my dashboard open on my laptop in a chrome tab and after a few days that also crashed (oh snap). Anyway I just thought it was my crappy device until i saw this thread. So i downgraded to 3.4.0 and bamn, the home assistant app has been running for days without a single crash.

edit i dont have mushroom cards installed. I checked the memory usage in chrome dev but could'nt really see where it was having an issue but on my laptop the memory for the one HA tab was 210mb (fluctuating but always came back to around that) on 3.4.0 but on 3.4.3 after 10 mins it was at 750mb. Not sure what the max mem per tab is in chrome but once it hit it i got the Oh snap on every tab...

@samuele2723
Copy link

Following, i massively use mushroom template cards with card mod.. and it's extremely slow and unresponsive. Any tips or any good alternative to mushroom to pair with card_mod?image

@ildar170975
Copy link
Contributor

massively use mushroom template cards with card mod

The author of mushroom cards does not recommend it.

@samuele2723
Copy link

massively use mushroom template cards with card mod

The author of mushroom cards does not recommend it.

I know, but still feels best out in terms of flexibility and the badge icon is just awesome addon

Nest custom card in custom card grid has just even worse performance

@ildar170975
Copy link
Contributor

I know, but still feels best out in terms of flexibility and the badge icon is just awesome addon

Well, if you experience issues with mushrooms - create an issue in the mushroom repo then (& this issue will be probably closed)

@pluusla
Copy link

pluusla commented Dec 20, 2024

I know, but still feels best out in terms of flexibility and the badge icon is just awesome addon

Well, if you experience issues with mushrooms - create an issue in the mushroom repo then (& this issue will be probably closed)

Thank you for your input. As I have already mentioned: I am using Mushroom Card, but without Card Mod customizations (can only speak for myself, see second entry of this issue) To verify this, I also created a dashboard without Mushroom Cards. The behavior (suspected memory leak) is the same. Therefore, in my humble opinion, it is still too early to simply close the issue.

@ildar170975
Copy link
Contributor

it is still too early to simply close the issue.

I am not proposing to close the issue. Instead I propose to create a minimal working example with standard cards to allow users to reproduce this issue on their setups.

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

7 participants