I am seeing NiFi occasionally getting restarted. In the nifi-app.log there is no indication of an error. NiFi was not processing any data and the server was not busy at this time. When I see in the nifi-bootstrap.log I see that
2021-06-17 16:44:00,551 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.status
2021-06-17 16:44:00,551 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.lock
2021-06-17 16:44:00,551 WARN [main] org.apache.nifi.bootstrap.RunNiFi Apache NiFi appears to have died. Restarting...
2021-06-17 16:44:00,552 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.pid
2021-06-17 16:44:00,555 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Saved Pid 17260 to /opt/nifi-1.10.0/run/nifi.pid
2021-06-17 16:44:00,555 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.status
2021-06-17 16:44:00,557 DEBUG [main] org.apache.nifi.bootstrap.RunNiFi Saved Properties {pid=17260} to /opt/nifi-1.10.0/run/nifi.status
2021-06-17 16:44:00,557 INFO [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi with Process ID 17260
2021-06-17 16:44:00,558 INFO [main] org.apache.nifi.bootstrap.RunNiFi Successfully started Apache NiFi with PID 17260
2021-06-17 16:44:01,128 DEBUG [NiFi Bootstrap Command Listener] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.status
2021-06-17 16:44:01,128 DEBUG [NiFi Bootstrap Command Listener] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.pid
2021-06-17 16:44:01,131 DEBUG [NiFi Bootstrap Command Listener] org.apache.nifi.bootstrap.RunNiFi Saved Pid 17260 to /opt/nifi-1.10.0/run/nifi.pid
2021-06-17 16:44:01,131 DEBUG [NiFi Bootstrap Command Listener] org.apache.nifi.bootstrap.RunNiFi Status File: /opt/nifi-1.10.0/run/nifi.status
My question is; how is the bootstrap process determining that "NiFi appears to have died"? Is it looking for the existence of the nifi.pid and nifi.status files? If so how often does it check for this? Is that configurable?
according to source-code nifi-bootstrap checking every second (not configurable) if main process is alive by checking if process has exit code available.
while (true) {
final boolean alive = isAlive(process);
if (alive) {
try {
Thread.sleep(1000L);
} catch (final InterruptedException ie) {
}
} else {
... restart process ...
public static boolean isAlive(final Process process) {
try {
process.exitValue();
return false;
} catch (final IllegalStateException | IllegalThreadStateException itse) {
return true;
}
}
sounds like your main nifi process stopping by some reason... check RAM available on server and -Xms
& -Xmx
parameters in bootstrap.conf
- usually it's the main reason.