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

[homekit] fix corrupt storage #7940

Merged
merged 3 commits into from
Jun 20, 2020
Merged

Conversation

yfre
Copy link
Contributor

@yfre yfre commented Jun 18, 2020

there are regular reports about "lost mac address" issue.
https://community.openhab.org/t/homekit-could-not-find-existing-mac/100845/8
https://community.openhab.org/t/need-to-reset-homekit-pairing-at-every-launch/13542/32

sometimes the mac address disappears from homekit.json and one need to repair home clients with openhab.

this issue is difficult to reproduce. there is no place in the source code where mac address gets removed from storage. there are only 2 places related to mac address: one is writing new mac to storage, another one is reading the mac from storage.
so, must be something like race condition and inconsistent state of the storage object

this PR reduces number of class which have references to storage object. it also stops a runnable that could potential try to update storage at binding stop/shutdown event.

changes:

  • remove reference to storage object from HomekitCommandExtension, use a a call of HomekitImpl method instead
  • stop Debouncer runnables on stop/shutdown event
  • add some additional logging.

it is unclear whether it will fix the issue but imho it is at least an improvement of the storage handling and shutdown process

Signed-off-by: Eugen Freiter [email protected]

Signed-off-by: Eugen Freiter <[email protected]>
@cpmeister cpmeister added the bug An unexpected problem or unintended behavior of an add-on label Jun 19, 2020
Signed-off-by: Eugen Freiter <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @yfre,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@openhab openhab deleted a comment from TravisBuddy Jun 20, 2020
@cpmeister cpmeister merged commit ac8c88b into openhab:2.5.x Jun 20, 2020
@cpmeister cpmeister added this to the 2.5.6 milestone Jun 20, 2020
@yfre yfre deleted the fix_race_condition branch June 20, 2020 17:34
knikhilwiz pushed a commit to knikhilwiz/openhab2-addons that referenced this pull request Jul 12, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: CSchlipp <[email protected]>
MPH80 pushed a commit to MPH80/openhab-addons that referenced this pull request Aug 3, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: MPH80 <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
Signed-off-by: Daan Meijer <[email protected]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
* fix for race conditions
* incorporate feedback
* reduce number of interactions with the storage. fix bug in clear method

Signed-off-by: Eugen Freiter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants