Fix various startup issues - #5787
Conversation
…plementation Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
…riptEngineFactoryBundleTracker take this into account. The goal of this is to make sure that the engine factories haven't just activated their services, but are actually done initializing. Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
The class combined annotated OSGi DS registration and programmatic registration. This clashes with the internal logic of DS, and causes visibility issues between services that are registered by different threads. In the chaos of OH startup, which can lead to intermittent failures and general unpredictability Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
|
The build fails because of a test failure: I had that locally too, but wrote it off as a flaky test because as far as I know, I've changed nothing that relates to edit: The test passed on Java 21 but failed on Java 25, so I still think it's just flaky. But, perhaps some of these changes have somehow made it more likely to fail? edit2: I've looked at the failing test, and there's no way it can be related to this PR. The whole test class depends on specific timings with lots of sleep statements, so it's fundamentally flaky. I can't see any recent changes to it though, but I guess there can be any number of things that have impacted how this runs. This particular flakiness seems to stem from #2954. I don't see any easy way to remove the flakiness, because expiry depends on timeouts, so it is "timing-based by design". It's still very vulnerable to failure on slow builders. The particular failure that failed here could be fixed by adding a |
This started out with a narrow focus on the Graal problems (and there's an upcoming companion PR for add-ons), but grew as I found more problems.
It's really 3 parts:
automation/scriptEngineFactoriesready marker for start level 40 works. Up until now, the script engines have been considered ready as soon as the bundle has started. But, that's not actually "true", some of them need some time to initialize asynchronously. I've created a mechanism to make it actually wait until the engine says it's "ready". This defaults totrueso that engines that don't implement this will still work the "old way" - that is, satisfy the requirement as soon as the bundle has been activated.WatchServiceImplregisters with OSGi. The current implementation mixes declarative style/annotations and programmatic registration, which causes problems. These problems have probably been around since Refactor WatchService #3004. DS is single-threaded, so it's not thread-safe. Making other threads also do registrations causes problems with visibility between components, which manifests, for example, with services that are claimed to beACTIVEreturnnullinstances. I've managed to find a way to avoid doing manual service registration by manipulatingConfigurationAdmininstead. It seems to relieve the problem.I'm leaving it as a draft, since I'm sure there are many things that will need to be changed/rearranged etc.
What can be said is that with this, and the corresponding changes I've done to
addons, JS scripting and Python scripting seem to be able to coexist happily, and startup behavior seems much more consistent/predictable without these "random failures" that currently exist where the solution is to ask the user to restart OH. I haven't built and tested this under Karaf, but I strongly suspect that this will make it possible to install/uninstall Graal add-ons dynamically, without having to restart OH, like all other add-ons.