jdeath / Roblox-Homeassistant

Roblox Sensor For Homeassistant
2 stars 1 forks source link

WARNING (MainThread) [supervisor.homeassistant.core] Watchdog found Home Assistant failed, restarting... #2

Closed mkanet closed 1 year ago

mkanet commented 1 year ago

Hey there, I really like the slightly modified Roblox sensor.py you provided a month ago or so. The modification made this addon much more useful and better looking by increasing the polling rate. However, I noticed that ever since I've added this custom component, every time I restart Home Assistant Core or Home Assistant Host, this custom component seems to produce the Supervisor log WARNING below after the reboot completes. It seems like Home Assistant might be crashing during shutdown.

WARNING (MainThread) [supervisor.homeassistant.core] Watchdog found Home Assistant failed, restarting...

As soon as I restored from backup without this custom component, the problem went away. As soon as I add it back, I see this problem happen again.

I didn't pay close enough attention to see if this issue also happens with the unmodified sensor.py.

Anyway, I just thought I'd let you know. Can you think of anything in this component that would adversely affect HA Core/HA Supervisor/HA Host during reboot?

It took me a while to figure out what was causing this issue. I even opened a Home Assistant Supervisor Issue on Github, not realizing what was causing the issue. I finally realized today that this Integration seems to be causing the problem.

jdeath commented 1 year ago

No idea. My default level of messages is error, so I do not see warning. I made a new release a week ago, which now uses async API calls (should be faster). Looks like you are not using that version yet. I am new to async, so I could be doing something wrong. Try that and see if problem still exists. There are some breaking changes and you'll need to update the code to point to your graphic, but should be easy.

Perhaps since you have that update rate turned up so high, the API calls are getting messed up. You could try change it to 1 minute to see if that is the issue. Also, since the new version is async it should handle it better.

mkanet commented 1 year ago

No idea. My default level of messages is error, so I do not see warning. I made a new release a week ago, which now uses async API calls (should be faster). Looks like you are not using that version yet. I am new to async, so I could be doing something wrong. Try that and see if problem still exists. There are some breaking changes and you'll need to update the code to point to your graphic, but should be easy.

Perhaps since you have that update rate turned up so high, the API calls are getting messed up. You could try change it to 1 minute to see if that is the issue. Also, since the new version is async it should handle it better.

Thank you so much for your suggestions. Could you please tell me how to change the update interval. I'm not sure if you are referring to RESTful sensors against any API or something else or you mean all API access in general.

I know that my RESTful API queries on Home Assistant are updating every 6 seconds for a 100 sensors. However I would prefer not to change that update interval. Also, the Roblox integration also had a relatively fast update interval.

Also, how can I get the update you're talking about with asych access? I would like to see if this helps. Thanks again for your help!

jdeath commented 1 year ago

Change the update interval in this integration sensor.py by making:

BASE_INTERVAL = timedelta(minutes=2)
SCAN_INTERVAL = timedelta(minutes=2)

I think you are using 0.25 which is probably too quick and might lead to an error on start. I am just guessing this could be a cause for the warning.

The latest version should show in HACS eventually, or just download/replace the sensor.py with the latest one in the repository. Review the readme, because I made some changes so users do not need to hardcode their domain in the code, it is now added as a configuration variable.

mkanet commented 1 year ago

@jdeath thank you so much! I appreciate it. The only reason why I changed the update interval is because this integration isn't usable to me if the status for each Roblox user takes longer than 45-50 seconds if there are 4 Roblox friends status to monitor.

If I change the settings you suggested will that change this integration to become unusable again?

.25 minute was ideal for me. What interval should I change it to if I don't want my 4 friends' status to no take much longer than it already does. Should I change them to maybe?

BASE_INTERVAL = timedelta(minutes=.35)
SCAN_INTERVAL = timedelta(minutes=.35)
mkanet commented 1 year ago

@jdeath I just used your latest sensor.py along with:

BASE_INTERVAL = timedelta(minutes=.35)
SCAN_INTERVAL = timedelta(minutes=.35)

This is causing another issue similar to the previous version. Except this time, it is also producing errors:

23-09-10 16:07:30 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
23-09-10 16:07:32 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove
23-09-10 16:07:32 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove

23-09-10 16:07:39 WARNING (MainThread) [supervisor.misc.tasks] Watchdog miss API response from Home Assistant

23-09-10 16:07:49 INFO (MainThread) [supervisor.homeassistant.core] Detect a running Home Assistant instance
23-09-10 16:08:47 INFO (SyncWorker_4) [supervisor.docker.manager] Restarting homeassistant
23-09-10 16:09:07 INFO (MainThread) [supervisor.homeassistant.core] Wait until Home Assistant is ready
23-09-10 16:09:08 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
23-09-10 16:09:08 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
23-09-10 16:09:09 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
23-09-10 16:09:09 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository
23-09-10 16:09:09 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository
23-09-10 16:09:09 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
23-09-10 16:09:11 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove
23-09-10 16:09:11 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove
23-09-10 16:09:27 INFO (MainThread) [supervisor.homeassistant.core] Detect a running Home Assistant instance
23-09-10 16:11:08 INFO (SyncWorker_3) [supervisor.docker.manager] Restarting homeassistant
23-09-10 16:11:28 INFO (MainThread) [supervisor.homeassistant.core] Wait until Home Assistant is ready
23-09-10 16:11:29 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
23-09-10 16:11:29 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
23-09-10 16:11:30 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
23-09-10 16:11:30 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository
23-09-10 16:11:30 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository
23-09-10 16:11:30 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
23-09-10 16:11:31 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove
23-09-10 16:11:31 INFO (MainThread) [supervisor.store] Loading add-ons from store: 71 all - 0 new - 0 remove

23-09-10 16:11:40 ERROR (MainThread) [supervisor.misc.tasks] Watchdog found a problem with Home Assistant API!
23-09-10 16:11:40 ERROR (MainThread) [supervisor.misc.tasks] Home Assistant watchdog reanimation failed!

23-09-10 16:11:48 INFO (MainThread) [supervisor.homeassistant.core] Detect a running Home Assistant instance
jdeath commented 1 year ago

If 0.25 was ideal before for 4 friends, then you want 1 minute now. Now all friends will be updated every minute.

I am not sure what those error messages are. If they do not keep coming back, then I would not worry about it. Honestly, switch your default log level to error and forget about it. You are seeing INFO messages, which are one step above debugging.

logger:
  default: error
mkanet commented 1 year ago

@jdeath Thank you so much for all your help. I figured out my issue. It had nothing to do with this integration. Your new async API calls work great! Closing this issue since there are no issues.