You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2015/11/26 15:30:30 UTC

[1/2] nifi git commit: NIFI-1059: If we get an IOException when telling NiFi to shutdown, just kill NiFi immediately, instead of giving up

Repository: nifi
Updated Branches:
  refs/heads/master 9aa9c27db -> 0609a84fa


NIFI-1059: If we get an IOException when telling NiFi to shutdown, just kill NiFi immediately, instead of giving up

Signed-off-by: joewitt <jo...@apache.org>


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

Branch: refs/heads/master
Commit: 757202b63e98ca0e9b60ca811f48054b0b4cefc7
Parents: 9aa9c27
Author: Mark Payne <ma...@hotmail.com>
Authored: Wed Nov 25 16:21:58 2015 -0500
Committer: joewitt <jo...@apache.org>
Committed: Thu Nov 26 01:03:53 2015 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/bootstrap/RunNiFi.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/757202b6/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 c8d1f4d..a3d3de7 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
@@ -627,13 +627,14 @@ public class RunNiFi {
 
         final Properties nifiProps = loadProperties(logger);
         final String secretKey = nifiProps.getProperty("secret.key");
+        final String pid = nifiProps.getProperty("pid");
 
         try (final Socket socket = new Socket()) {
             logger.debug("Connecting to NiFi instance");
-            socket.setSoTimeout(60000);
+            socket.setSoTimeout(10000);
             socket.connect(new InetSocketAddress("localhost", port));
             logger.debug("Established connection to NiFi instance.");
-            socket.setSoTimeout(60000);
+            socket.setSoTimeout(10000);
 
             logger.debug("Sending SHUTDOWN Command to port {}", port);
             final OutputStream out = socket.getOutputStream();
@@ -654,7 +655,6 @@ public class RunNiFi {
             if (SHUTDOWN_CMD.equals(response)) {
                 logger.info("Apache NiFi has accepted the Shutdown Command and is shutting down now");
 
-                final String pid = nifiProps.getProperty("pid");
                 if (pid != null) {
                     final Properties bootstrapProperties = new Properties();
                     try (final FileInputStream fis = new FileInputStream(bootstrapConfigFile)) {
@@ -703,7 +703,13 @@ public class RunNiFi {
                 logger.error("When sending SHUTDOWN command to NiFi, got unexpected response {}", response);
             }
         } catch (final IOException ioe) {
-            logger.error("Failed to send shutdown command to port {} due to {}", new Object[]{port, ioe.toString(), ioe});
+            if (pid == null) {
+                logger.error("Failed to send shutdown command to port {} due to {}. No PID found for the NiFi process, so unable to kill process; "
+                    + "the process should be killed manually.", new Object[] {port, ioe.toString(), ioe});
+            } else {
+                logger.error("Failed to send shutdown command to port {} due to {}. Will kill the NiFi Process with PID {}.", new Object[] {port, ioe.toString(), ioe, pid});
+                killProcessTree(pid, logger);
+            }
         } finally {
             if (lockFile.exists() && !lockFile.delete()) {
                 logger.error("Failed to delete lock file {}; this file should be cleaned up manually", lockFile);


[2/2] nifi git commit: NIFI-1059 Amending patch to fix identified logging output defect

Posted by jo...@apache.org.
NIFI-1059 Amending patch to fix identified logging output defect


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

Branch: refs/heads/master
Commit: 0609a84fa2b84085cea48cfb60095fd75a3bf07a
Parents: 757202b
Author: joewitt <jo...@apache.org>
Authored: Thu Nov 26 01:10:11 2015 -0500
Committer: joewitt <jo...@apache.org>
Committed: Thu Nov 26 09:28:50 2015 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/nifi/bootstrap/RunNiFi.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/0609a84f/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 a3d3de7..098be03 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
@@ -705,9 +705,9 @@ public class RunNiFi {
         } catch (final IOException ioe) {
             if (pid == null) {
                 logger.error("Failed to send shutdown command to port {} due to {}. No PID found for the NiFi process, so unable to kill process; "
-                    + "the process should be killed manually.", new Object[] {port, ioe.toString(), ioe});
+                    + "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(), ioe, pid});
+                logger.error("Failed to send shutdown command to port {} due to {}. Will kill the NiFi Process with PID {}.", new Object[] {port, ioe.toString(), pid});
                 killProcessTree(pid, logger);
             }
         } finally {