Paul Kelly created NIFI-11542:
---------------------------------

             Summary: RunNiFi's process detection and termination does not work 
on Windows
                 Key: NIFI-11542
                 URL: https://issues.apache.org/jira/browse/NIFI-11542
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 1.21.0
         Environment: Windows
            Reporter: Paul Kelly


Process detection and termination in 
nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java rely on 
running system commands ({{{}ps{}}} and {{{}kill{}}}) to determine if a process 
is alive and to terminate lingering processes.  The commands used do not exist 
on Windows.  Therefore, isProcessRunning always returns false and killing 
lingering processes also fails.  This can lead to the java.exe process sticking 
around after NiFi is stopped.

Once Java 11 is the minimum, Java's ProcessHandle could be used instead of 
running system commands, which would allow process detection and termination to 
work on Windows the same way it does on other operating systems.  Until then, 
OS detection could be used to run Windows commands on Windows and POSIX 
commands on everything else.  For example, {{tasklist}} and {{taskkill}} could 
be used.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to