Skip to content

NIFI-15509: Enable ControllerService reload additional classpath resources if needed#10812

Merged
bbende merged 1 commit intoapache:NIFI-15258from
bobpaulin:NIFI-15509
Jan 30, 2026
Merged

NIFI-15509: Enable ControllerService reload additional classpath resources if needed#10812
bbende merged 1 commit intoapache:NIFI-15258from
bobpaulin:NIFI-15509

Conversation

@bobpaulin
Copy link
Contributor

Summary

NIFI-15509

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@bobpaulin bobpaulin force-pushed the NIFI-15509 branch 2 times, most recently from b1f45f7 to 0613a7e Compare January 26, 2026 13:47
@bobpaulin bobpaulin marked this pull request as ready for review January 26, 2026 14:45
@markap14 markap14 added the NIP-11 NIP-11 adds support for Connectors label Jan 26, 2026
}

serviceNode.verifyCanEnable();
serviceNode.reloadAdditionalResourcesIfNecessary();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can also remove a similar line for processors here:


LOG.info("Starting {}", procNode);

if (procNode.isReloadAdditionalResourcesNecessary()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to check isReloadAdditionalResourcesNecessary() because inside reloadAdditionalResourcesIfNecessary() it is doing the same logic and only reloading if necessary

Choose a reason for hiding this comment

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

I agree we do not need to. I added the check because I wanted to avoid switching the thread classloader when it is not required. Performance wise probably very similar. There are only a few processors that use dynamic classloading so the idea was to skip the logic for the majority that don't need this functionality to reduce risk.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, I guess it ties to the other comment of whether we need the NarCloseable or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oddly I could not reproduce so I've removed the NARCloseable and the if conditional. Thank you for the feedback @bbende the error must have originated from something else.

LOG.info("Starting {}", procNode);

if (procNode.isReloadAdditionalResourcesNecessary()) {
try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, procNode.getComponent().getClass(), procNode.getIdentifier())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to use the NarCloseable here because inside reloadAdditionalResourcesIfNecessary() it is going to be closing this ClassLoader and creating a new one

Choose a reason for hiding this comment

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

I had originally written the code without it and I got an error that the code could not find one of the DBCP classes. I can remove it to provide the exact error but it does not appear to work properly without it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I would be interested to see the stacktrace just to understand... if we do need to use NarCloseable somewhere, it seems like it should be further inside the reload method, since otherwise we would be wrapping the whole reload with the ClassLoader that is being removed half way through

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Will dig into this a bit more and provide the error. I understand the concern let me see if perhaps there something unexpected about the current context classloader that's causing it.

if (service.isReloadAdditionalResourcesNecessary()) {
try (final NarCloseable ignored = NarCloseable.withComponentNarLoader(extensionManager, service.getComponent().getClass(), service.getIdentifier())) {
service.reloadAdditionalResourcesIfNecessary();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same two comments from the procNode section

Copy link
Contributor

@bbende bbende left a comment

Choose a reason for hiding this comment

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

+1 Thanks for looking into the issue and addressing the feedback, it looks good to me

@bbende bbende merged commit c46e290 into apache:NIFI-15258 Jan 30, 2026
1 of 11 checks passed
pvillard31 pushed a commit to pvillard31/nifi that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NIP-11 NIP-11 adds support for Connectors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants