[
https://issues.apache.org/jira/browse/NIFI-12567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17803340#comment-17803340
]
ASF subversion and git services commented on NIFI-12567:
--------------------------------------------------------
Commit c2098447a77cd33a84c0292b9d0afe4c983d756f in nifi's branch
refs/heads/support/nifi-1.x from Pierre Villard
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=c2098447a7 ]
NIFI-12567 - Prevent NPE in
CuratorLeaderElectionManager.getLeadershipChangeCount
Signed-off-by: Matt Burgess <[email protected]>
This closes #8203
> NPE in CuratorLeaderElectionManager.getLeadershipChangeCount
> ------------------------------------------------------------
>
> Key: NIFI-12567
> URL: https://issues.apache.org/jira/browse/NIFI-12567
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Pierre Villard
> Assignee: Pierre Villard
> Priority: Major
> Fix For: 1.25.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Since NiFi 1.10, a NPE can happen in the code of
> CuratorLeaderElectionManager.getLeadershipChangeCount when trying to get
> diagnostic data for a NiFi node:
>
> {code:java}
> ERROR org.apache.nifi.diagnostics.bootstrap.BootstrapDiagnosticsFactory:
> Failed to obtain diagnostics information from class
> org.apache.nifi.diagnostics.bootstrap.tasks.ClusterDiagnosticTask
> java.lang.NullPointerException: null
> at
> org.apache.nifi.controller.leader.election.CuratorLeaderElectionManager.getLeadershipChangeCount(CuratorLeaderElectionManager.java:241)
> at
> org.apache.nifi.diagnostics.bootstrap.tasks.ClusterDiagnosticTask.captureDump(ClusterDiagnosticTask.java:75)
> at
> org.apache.nifi.diagnostics.bootstrap.BootstrapDiagnosticsFactory.create(BootstrapDiagnosticsFactory.java:58)
> at
> org.apache.nifi.BootstrapListener.writeDiagnostics(BootstrapListener.java:288)
> at
> org.apache.nifi.BootstrapListener.access$600(BootstrapListener.java:41)
> at
> org.apache.nifi.BootstrapListener$Listener$1.run(BootstrapListener.java:240)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748) {code}
>
> The problematic line is here:
> [https://github.com/apache/nifi/blob/support/nifi-1.x/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/leader/election/CuratorLeaderElectionManager.java#L241]
> This problem does not exist in NiFi 2.x as we have a proper null check at
> [https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-leader-election-shared/src/main/java/org/apache/nifi/controller/leader/election/TrackedLeaderElectionManager.java#L60]
> This JIRA is to track the addition of a similar null check in the NiFi 1.x
> support line.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)