You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2022/02/25 04:21:47 UTC
[nifi] branch main updated: NIFI-9725: On shutdown, instead of spawning a background thread to shutdown Cluster Coordinator, do so in the calling thread. This avoids a race condition whereby the cluster coordinator cannot be determined because the other thread has shutdown the FlowController.
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 432f987 NIFI-9725: On shutdown, instead of spawning a background thread to shutdown Cluster Coordinator, do so in the calling thread. This avoids a race condition whereby the cluster coordinator cannot be determined because the other thread has shutdown the FlowController.
432f987 is described below
commit 432f98714fb700b038baf043053f0bf20b8b72bf
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Thu Feb 24 17:01:40 2022 -0500
NIFI-9725: On shutdown, instead of spawning a background thread to shutdown Cluster Coordinator, do so in the calling thread. This avoids a race condition whereby the cluster coordinator cannot be determined because the other thread has shutdown the FlowController.
This closes #5800
Signed-off-by: David Handermann <ex...@apache.org>
---
.../java/org/apache/nifi/controller/StandardFlowService.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java
index 5abbd0d..6d18032 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java
@@ -316,11 +316,11 @@ public class StandardFlowService implements FlowService, ProtocolHandler {
running.set(false);
if (clusterCoordinator != null) {
- final Thread shutdownClusterCoordinator = new Thread(clusterCoordinator::shutdown);
-
- shutdownClusterCoordinator.setDaemon(true);
- shutdownClusterCoordinator.setName("Shutdown Cluster Coordinator");
- shutdownClusterCoordinator.start();
+ try {
+ clusterCoordinator.shutdown();
+ } catch (final Throwable t) {
+ logger.error("Failed to properly shutdown coordinator", t);
+ }
}
if (!controller.isTerminated()) {