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

Fix things in REMOVING state initialize instead of getting removed #2828

Merged
merged 2 commits into from
Mar 14, 2022

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Mar 9, 2022

This solves eclipse-archived/smarthome#942

If a thing changes its status to REMOVING when it is not initialized the thing cannot be removed because handleRemoval cannot be called on an uninitialized handler. This is likely to happen when a binding is not available. When the binding becomes available again, the ThingManager erroneously changed the thing status to INITIALIZING and the thing handler get's initialized and ONLINE later. This PR calls initialize on the handler (so handleRemoval can be called later) but preserves the REMOVING status. When the ThingHandler tries to change the status to ONLINE, handleRemoval is called and the thing finally removed.

IMO #2517 should be closed if this is merged, as it is expected that either handleRemoval is called or the thing is force removed.

Signed-off-by: Jan N. Klug github@klug.nrw

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K requested a review from a team as a code owner March 9, 2022 18:56
@wborn wborn added the bug An unexpected problem or unintended behavior of the Core label Mar 13, 2022
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!
It looks good to me except for a small typo:

…thing/internal/ThingManagerImpl.java

Co-authored-by: Wouter Born <github@maindrain.net>
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@wborn wborn merged commit 437b31d into openhab:main Mar 14, 2022
@wborn wborn added this to the 3.3 milestone Mar 14, 2022
@J-N-K J-N-K deleted the bug-removingstatenothonored branch March 14, 2022 16:24
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
…penhab#2828)

Signed-off-by: Jan N. Klug <github@klug.nrw>
GitOrigin-RevId: 437b31d
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 the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thing that is disabled and then deleted, stays indefinite on status 'removing'
2 participants