[
https://issues.apache.org/jira/browse/NIFI-16320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113305#comment-18113305
]
ASF subversion and git services commented on NIFI-16320:
--------------------------------------------------------
Commit 3766b74a50d507ff8ee44f5d3127d40f852f183c in nifi's branch
refs/heads/main from Mark Payne
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=3766b74a50d ]
NIFI-16320 Prevent connector GET from racing working-context recreation.
(#11647)
Connector GET can sync from the provider while the working flow context is
being recreated. Keep a live working context visible to callers by swapping a
per-context holder under the monitor. Destroy the previous working process
group before creating the replacement so clustered load-balanced connections
are not registered twice, then destroy leftover holders after unlock once their
use count reaches zero.
> NullPointerException in StandardConnectorNode due to null working flow context
> ------------------------------------------------------------------------------
>
> Key: NIFI-16320
> URL: https://issues.apache.org/jira/browse/NIFI-16320
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Mark Payne
> Assignee: Mark Payne
> Priority: Major
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> GET /nifi-api/connectors/\{id}
> can fail with a NullPointerException when a Connector is using an external
> configuration provider.
> The exception is:
> {code:java}
> Cannot invoke "FrameworkFlowContext.getConfigurationContext()" because
> "this.workingFlowContext" is null
> at
> org.apache.nifi.components.connector.StandardConnectorNode.replaceWorkingConfiguration
> {code}
> The GET path loads the latest provider configuration and calls
> {{{}replaceWorkingConfiguration{}}}. At the same time,
> {{recreateWorkingFlowContext}} can destroy the current working flow context
> before the replacement is created and assigned. A concurrent GET can then see
> a null working context.
> After the connector is initialized, callers must always observe a live
> working context. Replacement should install the new context before the
> previous one is destroyed, and Connector callbacks must not run while the
> working-context monitor is held.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)