Pierre Villard created NIFI-12567:
-------------------------------------
Summary: 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
Fix For: 1.25.0
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)