Skip to content

NMS-20606: Skip missing featuresBoot.d features instead of installing none - #9222

Draft
synqotik wants to merge 5 commits into
release-37.xfrom
jira/NMS-20606-karaf-extender-featuresboot-fix
Draft

synqotik wants to merge 5 commits into
release-37.xfrom
jira/NMS-20606-karaf-extender-featuresboot-fix

Conversation

@synqotik

@synqotik synqotik commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

The Karaf extender installs the boot features from etc/featuresBoot.d/ and from the features.boot files of the repositories in repositories/ and system/. It installed all of them in one FeaturesService.installFeatures call. Karaf resolves every name before it installs a feature. At the first name that no feature repository provides, Karaf throws No matching features for <name>/<version>, and the whole call fails.

Thus one stale entry stopped all boot features from installing, for example plugins, the Kafka producer and the gRPC exporter. OpenNMS continued to run, but those features were not installed. The log named only the first missing feature. It did not name the file, and it did not say that the other features were not installed. This problem also occurs on Minion and Sentinel. On those systems, featuresBoot.d usually holds most of the configuration.

NMS-20603 removed the vaadin-snmp-events-and-metrics feature. A stale entry for that feature in featuresBoot.d caused this failure. The release notes for NMS-20603 described the failure. This PR fixes it.

This PR:

  • skips each missing boot feature and installs all the other features in one call, as before;
  • logs one ERROR for each missing feature. The ERROR names the feature and each file that lists it;
  • does the same for the features that wait for a .kar file;
  • keeps the "Karaf extender" health check at Failure after an extender error. The check lists all errors.

Changes

Check each feature before the install (BootFeatureInstaller)

A new class, BootFeatureInstaller, has the install step. The main install thread in KarafExtender and the .kar install thread in KarDependencyHandler both use it.

  1. The installer groups the features by their install string (name or name/version). Thus a feature that two files list gets one check and one ERROR. The ERROR names the two files.
  2. For each install string, the installer calls FeaturesService.getFeatures(String nameOrId). In Karaf 4.4.11, this method uses FeatureReq.parseNameAndRange. installFeatures uses the same parser. Thus the check finds the same features that the install accepts, also for version ranges.
  3. If no feature matches, the installer skips the feature and logs this ERROR:
    Feature 'no-such-feature' listed in etc/featuresBoot.d/test.boot was not found and was skipped. Remove it from that file.
  4. If getFeatures throws an exception, the installer keeps the feature in the install set. installFeatures then reports the failure.
  5. The installer installs the remaining features in one installFeatures call. One call for each feature is slower, because each call does a full resolve and refresh.
  6. Other resolution failures, for example a missing requirement, still stop all features in that call. The ERROR now says so:
    Failed to install non-KAR features [...]. None of them were installed
    The log shows the exception after this line. The health check message adds : <cause>.
  7. The installer returns the number of installed features. The health check message shows this number. Before this PR, the message showed the number of requested features.

The installer does not use Option.NoFailOnFeatureNotFound. With that option, Karaf skips a missing feature, but it does not tell us which feature it skipped.

Record the source file of each feature (Feature.source)

Feature has a new source field. KarafExtender.getFeaturesIn() sets it to the path of the file, relative to Karaf home, for example etc/featuresBoot.d/kafka.boot or repositories/<name>/features.boot. The field is used only in messages. It is not part of equals or hashCode, so a !<feature> line in one file still removes the same feature from another file.

Keep extender errors in the health check (ExtenderStatus)

Before this PR, the health check showed only the last message. When both install threads finished, areWeCompletelyDone() set the status to Success, also after an error. The "Waiting on …" message from the .kar thread also replaced an earlier Failure with Starting.

Now ExtenderStatus keeps a list of all errors:

  • After the first error, the status stays at Failure. Each later message adds the list of errors, for example Waiting on [some-kar]. Problem: Feature 'x' listed in … or 3 non-KAR features installed. 2 problems: Feature 'x' … Feature 'y' ….
  • Each error in the list ends with a period, and a space separates the errors.
  • This applies to all extender errors, not only missing features. For example, Failed to add feature repository '…'. Skipping now also keeps the status at Failure.
  • The two install threads share ExtenderStatus, so its methods are now synchronized.

To clear the failure, the operator removes the entry, or adds !<feature> to a file in featuresBoot.d, and restarts. No command resets the health check. The follow-up ticket for an opennms:health-check --clear option is in progress.

Other changes

  • KarDependencyHandler: uses BootFeatureInstaller. Before this PR, a missing .kar feature stopped all .kar features. After an error, the handler also set the health check back to Success.
  • container/extender/pom.xml: adds mockito-core as a test dependency. The version comes from the root POM.
  • whatsnew.adoc:
    • The NMS-20603 entry about featuresBoot.d now gives the new behavior.
    • A new section, "Missing boot features no longer block other boot features", tells what changed and how to clear the health check failure.
  • The OSGi Import-Package header of the bundle did not change.

Manual test

Do these steps on OpenNMS. Then do steps 1 to 6 again on Minion or Sentinel, if possible.

  1. Find a feature that is not installed by default, for example opennms-kafka-producer. Make sure that feature:list -i | grep kafka-producer shows nothing.
  2. Create etc/featuresBoot.d/kafka-producer.boot with the line opennms-kafka-producer.
  3. Create etc/featuresBoot.d/test.boot with the line no-such-feature.
  4. Create etc/featuresBoot.d/test2.boot with the lines no-such-feature and other-missing-feature/[99,100).
  5. Start OpenNMS.
  6. Make sure that:
    • karaf.log has one ERROR for no-such-feature that names test.boot and test2.boot, and one ERROR for other-missing-feature/[99,100).
    • feature:list -i | grep kafka-producer shows the feature as installed.
    • opennms:health-check shows "Karaf extender" as Failure, and the message lists the two missing features.
    • curl -s -o /dev/null -w '%{http_code}\n' -u admin:admin http://localhost:8980/opennms/rest/health/probe returns 599.
  7. Remove test.boot and test2.boot. Restart OpenNMS.
  8. Make sure that opennms:health-check shows "Karaf extender" as Success, and the probe returns 200.
  9. Optional: Add the line !no-such-feature to a new file in featuresBoot.d, and put back test.boot. Restart. Make sure that karaf.log has no ERROR for no-such-feature.

Follow-ups not in this PR

  • Add opennms:health-check --clear to acknowledge Karaf extender errors. In the case where there is an error that was skipped, as in the above manual test, the user might want to clear the health-check failure status (basically acking it), so that health-check then reports only new errors, instead of it always reporting a bad state for an already-acknowledged error. To be done in NMS-20669.

  • opennms:health-check garbles its output when a message is wider than the terminal. While testing this PR, the errors messages in health-check are fairly long, and I found that they seemed to repeat. This is due to a bug in our health-check console output. To be fixed in NMS-20670.

External References

… none

KarafExtender installed every boot feature from etc/featuresBoot.d and the
repository features.boot files in one installFeatures call, so one feature
that no repository provides stopped all of them from installing. Each feature
is now checked with FeaturesService.getFeatures first. A missing feature is
skipped, with an ERROR that names it and the files that list it, and the
others are installed. KarDependencyHandler uses the same check for features
that wait on a .kar.

Extender errors are now sticky: the Karaf extender health check stays at
Failure and lists every error, even after both install threads finish.
@github-actions github-actions Bot added the docs label Dec 2, 2026
…a space

Each error in the list now ends with a period, so the message reads
'... from those files. Feature ...' instead of '... from those files.; Feature ...'.

@cgorantla cgorantla left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure if we need to fix this.

featureBoot.d with wrong feature files are config issues. It would be better to sort them at the boot up time than starting OpenNMS with missing features.

@cgorantla

Copy link
Copy Markdown
Contributor

I'm not sure if we need to fix this.

featureBoot.d with wrong feature files are config issues. It would be better to sort them at the boot up time than starting OpenNMS with missing features.

This PR seems to only fix the missing feature part. Need to think if we should throw and stop the boot.

…ce and docs

- Skip a boot entry that Karaf can't parse (IllegalArgumentException from
  getFeatures, for example 'foo/[1,'), like a missing feature, instead of
  letting it stop every boot feature from installing.
- After the first lookup failure of another kind, log one WARN and install
  the remaining features without checking them.
- Advise a '!' line, not an edit, for entries in repository features.boot
  files; give no advice for wait-for-kar entries, which '!' can't remove.
- Health check message: no '..' or '.:', no trailing space.
- Test KarDependencyHandler.run() through a package-private constructor
  that takes the .kar storage folder.
- Record the current '!' matching rules in tests; '!' behavior unchanged.
- Docs: boot feature files, missing/invalid entries and the exact '!'
  rules in development/minion/container.adoc (fix features.uri name);
  link it from the core install page; update the release notes, including
  the effect on container health checks.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants