home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.75k stars 2.55k forks source link

Cannot add a new helper in UI sometimes - seeing a loading indicator #20809

Closed ildar170975 closed 2 days ago

ildar170975 commented 2 weeks ago

Checklist

Describe the issue you are experiencing

I think I have seen a similar issue - but cannot find it. Experience the issue for at least a year. May be - longer, cannot say for sure since I am not using UI for adding/editing helpers usually, only for a testing purpose.

The issue is that in 100% cases when I try to add a helper - I see this: изображение

And this indicator may be rotating for a VERY long time (minutes at minimum). Usually I press F5 when I see that this is a long process and try to repeat. Sometimes the "Add a helper" dialogue is shown after a minute, sometimes - faster. I observe a huge CPU & RAM load when this indicator is rotating. No messages in Log.

Describe the behavior you expected

The "add a new helper" dialog is shown within a few seconds.

Steps to reproduce the issue

see above

What version of Home Assistant Core has the issue?

2024.5.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chrome 124.0.6367.202

Which operating system are you using to run this browser?

Win10x64

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

silamon commented 2 weeks ago

There was an issue, but that was related to the schedule helper not being able to load. That was fixed.

Whenever you have this, check the javascript console for errors. If there are no errors in the javascript console, it must be the loading explained below that fails.

At the point the loading indicator is shown (and never goes away), it needs to do the following:

ildar170975 commented 1 week ago

check the javascript console for errors. If there are no errors in the javascript console, it must be the loading explained below that fails.

Took a minute from this:

изображение

to this:

изображение

Can you suggest me what shall I do next?

silamon commented 1 week ago

Could you try safe mode first to see if that brings better times?

ildar170975 commented 1 week ago

In safe mode the window is displayed immediately. Does this mean that some custom integration prevents to show the window fast?

silamon commented 1 week ago

It loads the integration titles for all integrations (helpers, core integrations, custom integrations) at that point. I'm not sure if the amount of custom integrations make it slower or if there would be a specific custom integration that takes a while.

ildar170975 commented 1 week ago
  1. I believed that "Add a helper" window allows to create a helper for STOCK integrations, not custom ones. Checked a content of this window- yes, only stock integrations. Then what is a reason of loading titles for ALL integrations then?

изображение

  1. On the run right after that test "safe mode" run - the window is shown immediately. How can a "safe mode" run fix (may be for a while) this problem?
silamon commented 1 week ago
  1. It's not really know what the helpers are when the integration title translations are fetched.
  2. Once the integrations title translations are fetched, they are kept in memory until you refresh the whole application.
ildar170975 commented 1 week ago

Noticed that after HA reboot it again needs ~1 minute to show a window.

silamon commented 1 week ago

If you're able to find out if the slowdown comes from the amount of custom integrations you have and not from a single particular one, I'll be able to change it, so it loads only the integration title translations from the helpers.

ildar170975 commented 1 week ago

I am thinking about finding a culprit. I have some custom integrations - some are defined in yaml, some in UI. Shall I check for both types?

silamon commented 1 week ago

I think you should check the custom integrations that define a config flow (others said, are configurable from the UI) I should mention that it would be good to find the culprit as that would help towards the general performance of your home assistant as well.

ildar170975 commented 1 week ago

custom integrations that define a config flow (others said, are configurable from the UI)

Not too many of them: fontawesome gismeteo iPhone device tracker places ha-composite-tracker

Shall I disable them one by one - or delete?

silamon commented 1 week ago

Setup a logger in your configuration yaml:

logger:
  default: info
  logs:
    homeassistant.config_entries: debug # add this

Then load the add helper and check for any late "Loaded from "

ildar170975 commented 1 week ago

Added these lines for logger, rebooted - and see no freezes for "add a helper". Will keep observing within these days.

Thanks for a feedback!

ildar170975 commented 2 days ago

Still do not observe freezes "add a helper". Closing this issue. Will reopen if needed. Thanks again for support!