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

GreenEye Monitor component delays restart of Home Assistant after 2024.2.1 #41

Closed
bakerkj opened this issue Feb 11, 2024 · 4 comments
Closed

Comments

@bakerkj
Copy link

bakerkj commented Feb 11, 2024

Describe the bug

This custom component seems to blocks/delays a clean restart of Home Assistant. I don't think this happened in 2024.1.x, I skipped 2024.2.0 and it does appear to happen in 2024.2.1.

On restart I see these warnings:

2024-02-10 23:17:19.705 WARNING (MainThread) [homeassistant.core] Shutdown stage 'stop integrations': still running: <Task pending name='Task-100718' coro=<async_setup_entry.<locals>.close_monitors() running at /config/custom_components/greeneye_monitor/__init__.py:148> wait_for=<Future pending cb=[Task.task
_wakeup()]> cb=[set.remove()]>
2024-02-10 23:18:19.708 WARNING (MainThread) [homeassistant.core] Timed out waiting for final writes to complete, the shutdown will continue
2024-02-10 23:18:19.708 WARNING (MainThread) [homeassistant.core] Shutdown stage 'final write': still running: <Task pending name='Task-100718' coro=<async_setup_entry.<locals>.close_monitors() running at /config/custom_components/greeneye_monitor/__init__.py:148> wait_for=<Future pending cb=[Task.task_wakeu
p()]> cb=[set.remove()]>
2024-02-10 23:18:49.711 WARNING (MainThread) [homeassistant.core] Timed out waiting for close event to be processed, the shutdown will continue
2024-02-10 23:18:49.711 WARNING (MainThread) [homeassistant.core] Shutdown stage 'close': still running: <Task pending name='Task-100718' coro=<async_setup_entry.<locals>.close_monitors() running at /config/custom_components/greeneye_monitor/__init__.py:148> wait_for=<Future pending cb=[Task.task_wakeup()]> 
cb=[set.remove()]>

Diagnostics

I'll grab these shortly.

@jkeljo
Copy link
Owner

jkeljo commented Feb 11, 2024

Interesting. I'm still on 2023.8, so I've got some upgrading to do. This integration hasn't changed in a while, but it looks like there have been some changes to how HA Core handles shutdown. As far as I can tell locally, it's generally been able to close the server quickly on my instance. I'll upgrade my local install and see if I can repro. If not, I'll see about adding some more logging at least.

@jkeljo
Copy link
Owner

jkeljo commented Feb 18, 2024

Well, I can repro in my actual home assistant instance, but not in the dev container that I use to develop this integration. So that's fun.

It looks like the reason this is appearing now is that the behavior of Server.wait_closed changed in Python 3.12 (python/cpython#79033), so it's exposing a bug in the shutdown order in greeneye_monitor. Working to figure that out now.

@jkeljo
Copy link
Owner

jkeljo commented Feb 19, 2024

@jkeljo jkeljo closed this as completed Feb 19, 2024
@bakerkj
Copy link
Author

bakerkj commented Feb 19, 2024

@jkeljo thanks for the fix!

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

2 participants