jbonofre opened a new pull request, #2974: URL: https://github.com/apache/karaf/pull/2974
Backport of #2973 to `karaf-4.4.x`. Integration tests fail randomly on this branch in classes unrelated to the change being built, for example on #2972: - `JmsSshCommandSecurityTest`: `Bundle cannot be installed`, caused by `BundleException: Resolver hook prevented resolution. Unresolved requirements: []` - `JaasTest.testLoginSingleReg` and `KarSshCommandSecurityTest`: `ClassNotFoundException: ... not found by PAXEXAM-PROBE-...` - `RejectedExecutionException` from `FeaturesServiceImpl.doProvisionInThread`, on an executor that is terminated after exactly one completed task (hidden by the retry rule) `BaseActivator` schedules a run (`doStop()` + `doStart()`) each time a tracked service or the configuration changes. If a tracked service shows up while a run is in progress, `doStart()` can already see it and start the activator completely, and the run scheduled for that same change then stops and starts everything again. The features activator tracks the `mvn` URL handler, which is registered asynchronously. When it shows up while the features activator processes its first run, the boot features are installed, `BootFinished` is published, then the `FeaturesService` and the region hooks are unregistered and registered again. Pax Exam installs the test probe at that very moment, so the region resolver hook can prevent its resolution, and the `FeaturesService` the test got can be a stopped one. `doStart()` now works on the tracked services and the configuration read at the beginning of the run, and a run is skipped when they are the ones the activator has already been started with. A tracked service or a configuration that really changes restarts the activator as before. See #2973 for the details and for how the failure was reproduced. ## Backport notes - Clean cherry-pick: `BaseActivator.java` was identical on `main` and `karaf-4.4.x` before the change. - The reproduction with a forced timing was done on `main` only. On this branch I ran the tests below. Tested locally on this branch on JDK 11: - unit tests of `util` (including the new `BaseActivatorTest`) and `features/core` - `mvn -Ptest -f itests/test/pom.xml test` for `BundleTest`, `ConfigTest`, `ConfigExampleTest`, `FeatureTest`, `HttpTest`, `InstanceTest`, `JaasTest`, `JMXSecurityTest`, `KarTest`, `LogTest`, `JmsSshCommandSecurityTest`, `KarSshCommandSecurityTest`, `SystemTest` and `WrapperTest`: 79 tests run, 0 failures -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
