fix(coordinator): guarantee setup event is set to prevent deadlock on failed initialization#669
Open
firstof9 wants to merge 3 commits into
Open
fix(coordinator): guarantee setup event is set to prevent deadlock on failed initialization#669firstof9 wants to merge 3 commits into
firstof9 wants to merge 3 commits into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #669 +/- ##
==========================================
+ Coverage 84.14% 92.23% +8.09%
==========================================
Files 10 41 +31
Lines 801 4817 +4016
Branches 0 30 +30
==========================================
+ Hits 674 4443 +3769
- Misses 127 374 +247
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves #668.
When the Keymaster coordinator fails to set up (due to connection failures or missing dependencies during Home Assistant startup), the
_initial_setup_done_eventis never set. Consequently, when a user tries to delete or reconfigure the integration entry afterwards, any downstream calls waiting on this event (await self._initial_setup_done_event.wait()) hang indefinitely. This blocks the config entry unloading task, causing Home Assistant Core to hang and eventually be terminated by the watchdog (SIGKILL / Exit 256).Proposed change
Wrapping the core setup in a
try...finallyblock ensures that_initial_setup_done_eventis always set even if setup fails, allowing entry cleanup/deletion or reload to proceed normally.Type of change
Additional information