KaiSong-UK opened a new pull request, #18451:
URL: https://github.com/apache/dolphinscheduler/pull/18451

   ## Summary
   
   When stopping a workflow, `ProcessUtils.isProcessAlive()` uses `kill -0` to 
check if a process exists. Two scenarios cause false negatives:
   
   1. **Permission denied**: When a child process runs under `sudo`, `kill -0 
<pid>` may return "Operation not permitted" even though the process is alive. 
This causes the worker to skip sending kill signals to the remaining process 
tree, leaving the workflow stuck in `READY_STOP`.
   
   2. **Non-empty stderr with exit code 0**: Shell profiles can emit readonly 
variable warnings to stderr even when `kill -0` succeeds (exit code 0). Since 
`AbstractShell` throws `ExitCodeException` when stderr is non-empty, the 
process is incorrectly marked as dead.
   
   ## Solution
   
   In `ProcessUtils.isProcessAlive()`, when `kill -0` throws an exception:
   
   - Check if the exception is an `ExitCodeException` with exit code 0 
(stderr-only noise) → process is alive
   - Check if the error message contains "not permitted" → process exists but 
cannot be signalled → alive
   - Otherwise → process does not exist
   
   This allows the kill flow to correctly identify and signal child processes 
that would otherwise be missed.
   
   Closes #18311
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to