[
https://issues.apache.org/jira/browse/NIFI-14156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Balázs Gerner updated NIFI-14156:
---------------------------------
Component/s: Core Framework
> Issue with nifi.cmd stop Command on Windows in Apache NiFi 2.0/2.1
> ------------------------------------------------------------------
>
> Key: NIFI-14156
> URL: https://issues.apache.org/jira/browse/NIFI-14156
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 2.0.0, 2.1.0
> Reporter: Balázs Gerner
> Priority: Major
>
> *Summary:*
> The {{nifi.cmd stop}} command in Apache NiFi 2.0 and 2.1 fails to stop the
> application on Windows, displaying an error:
> {{org.apache.nifi.bootstrap.Command Application Process not running.}}
> This issue appears to be specific to Windows platforms, as the same code
> functions correctly on Linux and macOS.
> *Steps to Reproduce:*
> # Start Apache NiFi using the command: {{{}bin/nifi.cmd start{}}}.
> # Attempt to stop it using the command: {{{}bin/nifi.cmd stop{}}}.
> *Observed Behavior:*
> The stop command fails with the error:
> {{org.apache.nifi.bootstrap.Command Application Process not running.}}
>
> *Technical Analysis:*
> * *Root Cause:*
> The issue originates from the
> [{{{}StandardProcessHandleProvider{}}}#L73,|https://github.com/apache/nifi/blob/rel/nifi-2.0.0/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/command/process/StandardProcessHandleProvider.java#L73]
> where the application process arguments are expected but are found empty on
> Windows. This prevents the application process handle from being identified.
> * *Platform Dependency:*
> This behavior appears to be linked to platform-specific limitations in the
> Windows implementation of the {{ProcessHandle}} class. A potentially related
> issue is described in JDK-8176725, which outlines platform-dependent
> discrepancies in process argument handling.
> * *Related Code Reference:*
> The current {{ProcessHandleImpl}} implementation for Windows, which lacks
> argument information support, can be found
> [here|https://github.com/openjdk/jdk/blob/jdk-21%2B35/src/java.base/windows/native/libjava/ProcessHandleImpl_win.c].
>
> *Tested Configurations:*
> * *OS:* Windows Server 2025 (Version 24H2, OS Build 26100.2314).
> * *JDKs:* Zulu 21 JDK and OpenJDK 21.
>
> *Key Observations:*
> # The behavior is specific to Windows. On Linux and macOS, the {{nifi.cmd
> stop}} command functions as expected.
> # The refactored runtime management in NiFi 2.0 eliminated reliance on lock
> files and custom socket communication, but this introduced a gap in the stop
> command functionality on Windows.
> *Potential Solutions:*
> * *Ideal:* JVM updates to address the limitations of {{ProcessHandle}} on
> Windows.
> * *Alternative:* Implement a workaround in NiFi for process management on
> Windows.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)