Repository: nifi
Updated Branches:
  refs/heads/master 3a7ddc6a3 -> 6a8c2dba1


NIFI-1238: Ensure that if we timeout when communicating with NiFi and do a kill 
-9 that we also delete the status file; otherwise, the already-running 
bootstrap will restart nifi

Signed-off-by: joewitt <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/ff5330d7
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/ff5330d7
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/ff5330d7

Branch: refs/heads/master
Commit: ff5330d7f27fefede59b804210741e845d39693f
Parents: 3a7ddc6
Author: Mark Payne <[email protected]>
Authored: Tue Dec 1 21:01:35 2015 -0500
Committer: joewitt <[email protected]>
Committed: Tue Dec 1 22:53:09 2015 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/nifi/bootstrap/RunNiFi.java       | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/ff5330d7/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
----------------------------------------------------------------------
diff --git 
a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java 
b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
index 098be03..ea81277 100644
--- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
+++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
@@ -628,6 +628,7 @@ public class RunNiFi {
         final Properties nifiProps = loadProperties(logger);
         final String secretKey = nifiProps.getProperty("secret.key");
         final String pid = nifiProps.getProperty("pid");
+        final File statusFile = getStatusFile(logger);
 
         try (final Socket socket = new Socket()) {
             logger.debug("Connecting to NiFi instance");
@@ -693,7 +694,6 @@ public class RunNiFi {
                         }
                     }
 
-                    final File statusFile = getStatusFile(logger);
                     if (statusFile.exists() && !statusFile.delete()) {
                         logger.error("Failed to delete status file {}; this 
file should be cleaned up manually", statusFile);
                     }
@@ -708,7 +708,11 @@ public class RunNiFi {
                     + "the process should be killed manually.", new Object[] 
{port, ioe.toString()});
             } else {
                 logger.error("Failed to send shutdown command to port {} due 
to {}. Will kill the NiFi Process with PID {}.", new Object[] {port, 
ioe.toString(), pid});
+                notifyStop();
                 killProcessTree(pid, logger);
+                if (statusFile.exists() && !statusFile.delete()) {
+                    logger.error("Failed to delete status file {}; this file 
should be cleaned up manually", statusFile);
+                }
             }
         } finally {
             if (lockFile.exists() && !lockFile.delete()) {

Reply via email to