Arvind Kandpal created NIFI-16603:
-------------------------------------
Summary: Bootstrap stop command reports failure after successful
forced termination
Key: NIFI-16603
URL: https://issues.apache.org/jira/browse/NIFI-16603
Project: Apache NiFi
Issue Type: Bug
Components: Core Framework
Reporter: Arvind Kandpal
When the application process does not stop within the graceful shutdown
timeout, StopBootstrapCommand falls back to ProcessHandle.destroyForcibly().
The check on the return value of destroyForcibly() is inverted.
When destroyForcibly() returns true (the kill request was accepted), the
command logs "Application Process [pid] force termination failed" and does not
wait for the process to exit, so the command status stays ERROR. The branch
that waits for exit and sets SUCCESS only runs when destroyForcibly() returns
false.
Steps to reproduce:
1. Run StopBootstrapCommand against an application process that does not exit
on SIGTERM within the graceful shutdown timeout. For example, use a process
that ignores SIGTERM: sh -c "trap '' TERM; while true; do sleep 1; done"
2. Run the stop command.
Expected: the process is killed, the log says "force termination completed",
and the command status is SUCCESS.
Actual: the process is killed, but the log says "force termination failed" and
the command status is ERROR (exit code 1).
This was introduced in NIFI-13665. The destroy() method a few lines above
handles its return value the right way.
Code: nifi-bootstrap, StopBootstrapCommand.java, destroyForcibly()
StopBootstrapCommandTest does not cover this case, because the mocked
destroyForcibly() returns false by default.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)