-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Improve FeatureInstaller #3049
Improve FeatureInstaller #3049
Conversation
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
} | ||
featuresService.installFeatures(addons, | ||
EnumSet.of(FeaturesService.Option.Upgrade, FeaturesService.Option.NoFailOnFeatureNotFound)); | ||
featuresService.installFeatures(addons, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wborn Do you know if this might cause issues? The reason I added it is that some add-ons cause org.openhab.core
to refresh if it is not set. As a result the EventPublisher
is unloaded and this service is stopped. If a lot of add-ons are installed at the same time, this will result in an InterruptedException
in FeaturesService.installFeatures
which in turn shows up as ERROR in the log. At the next start everything is fixed.
It would be great if there is a documentation for the FeaturesService.Option
(at least I didn't find it). Do you know of such a document?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is much documentation for the FeaturesService
besides JavaDocs and the code itself. So if that doesn't help, mailing questions on the Karaf mailing list might help.
Maybe you can figure out what causes the bundle refresh in the first place and prevent it from happening?
The Karaf docs describes the reasons for automatically refreshing bundles:
For instance, a bundle has to be refreshed:
- when bundle A uses an import package, and bundle B is installed providing a new version of the package (matching bundle A import version range). Then bundle A has to be refreshed to use the new version of the package.
- when bundle A uses an optional import package, and bundle B is installed providing this package. Then, bundle A has to be refreshed to actually use the package.
- when bundle A uses a package provided by bundle B, then, bundle A will be refreshed as well. This is kind of "cascading" refresh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a result the
EventPublisher
is unloaded and this service is stopped
Would the feature installation succeed when refreshing occurs while the EventPublisher
has reference cardinaltiy optional? If that works, it could continue and for instance post any events whenever the EventPublisher
is set again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that makes a difference. If the EventPublisher
is removed, this is most likely because the org.openhab.core
bundle is refreshed. This will automatically refresh the org.openhab.core.karaf
bundle and the service is de-activated anyway. I now removed immediate refreshing during installation and added a refresh after all config updates have been processed (but only if the add-on configuration changed).
I think I found it (or at least one reason). This is the tree for
When installing
So an optional dependency is fulfilled and because of (2) the core bundle is refreshed. This causes a lot of other bundles to refresh (including all UI bundles). I believe there are similar issues with other bundles/features and this might also be the reason for a lot of strange behavior when installing add-ons, especially if several add-ons are installed at the same time (e.g. after an upgrade). This not only affects the I'm not sure how to address that. We could add |
Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Jan N. Klug <github@klug.nrw>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Looks like this is a required dependency for #3004 anyhow. |
Signed-off-by: Jan N. Klug <github@klug.nrw>
I moved JNA to an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let's test if this fixes all the flaws. 🙂
* Improve FeatureInstaller * Remove unnecessary synchronized and clean up processing * Re-add refeshing bundles after all configuratzion changes are processed * Prevent unnecessary refreshes * Make JNA part of the tp Signed-off-by: Jan N. Klug <github@klug.nrw> GitOrigin-RevId: dca8088
There are some flaws in the
FeatureInstaller
which this PR tries to solve. While debugging #3025 I found that the periodic sync job sets the config cache before the configuration is applied. This might lead to issues if another call tomodified
re-sets the configuration to something else but does not update the configuration cache. It is also not ensured that all configuration updates are processed in the order they arrive, so the asynchronous processing of the updates might result in an older configuration overwriting a newer one.This PR
modified
and processes them in the correct orderSigned-off-by: Jan N. Klug github@klug.nrw