mirror of https://github.com/apache/nifi.git
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 <joewitt@apache.org>
This commit is contained in:
parent
3a7ddc6a35
commit
ff5330d7f2
|
@ -628,6 +628,7 @@ public class RunNiFi {
|
||||||
final Properties nifiProps = loadProperties(logger);
|
final Properties nifiProps = loadProperties(logger);
|
||||||
final String secretKey = nifiProps.getProperty("secret.key");
|
final String secretKey = nifiProps.getProperty("secret.key");
|
||||||
final String pid = nifiProps.getProperty("pid");
|
final String pid = nifiProps.getProperty("pid");
|
||||||
|
final File statusFile = getStatusFile(logger);
|
||||||
|
|
||||||
try (final Socket socket = new Socket()) {
|
try (final Socket socket = new Socket()) {
|
||||||
logger.debug("Connecting to NiFi instance");
|
logger.debug("Connecting to NiFi instance");
|
||||||
|
@ -693,7 +694,6 @@ public class RunNiFi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final File statusFile = getStatusFile(logger);
|
|
||||||
if (statusFile.exists() && !statusFile.delete()) {
|
if (statusFile.exists() && !statusFile.delete()) {
|
||||||
logger.error("Failed to delete status file {}; this file should be cleaned up manually", statusFile);
|
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()});
|
+ "the process should be killed manually.", new Object[] {port, ioe.toString()});
|
||||||
} else {
|
} 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});
|
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);
|
killProcessTree(pid, logger);
|
||||||
|
if (statusFile.exists() && !statusFile.delete()) {
|
||||||
|
logger.error("Failed to delete status file {}; this file should be cleaned up manually", statusFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (lockFile.exists() && !lockFile.delete()) {
|
if (lockFile.exists() && !lockFile.delete()) {
|
||||||
|
|
Loading…
Reference in New Issue