hutiefang76 opened a new pull request, #18366: URL: https://github.com/apache/dolphinscheduler/pull/18366
## Purpose Fix #18311. When DolphinScheduler checks whether task child processes are still alive, `kill -0` can fail with permission-related stderr or even exit with code 0 while shell profile warnings are written to stderr. The previous logic treated every exception from the alive check as "process gone", which could make task kill verification report success while child processes were still alive. ## Changes - Expose `ExitCodeException#getExitCode()` so callers can distinguish `kill -0` exit semantics. - Treat `Operation not permitted` / `Permission denied` from `kill -0` as evidence that the process still exists. - Treat `ExitCodeException` with exit code `0` from `kill -0` as alive, covering shell profile stderr warnings. - Add regression tests for both permission-denied and zero-exit-with-stderr cases. ## Verification ```bash JAVA_HOME=$(/usr/libexec/java_home -v 17) ./mvnw -pl dolphinscheduler-task-plugin/dolphinscheduler-task-api -am -Dtest=ProcessUtilsTest#testKillProcessTreatsPermissionDeniedAsAlive+testKillProcessTreatsZeroExitWithProfileWarningAsAlive -Dsurefire.failIfNoSpecifiedTests=false clean test ``` Result: `Tests run: 2, Failures: 0, Errors: 0`. ```bash JAVA_HOME=$(/usr/libexec/java_home -v 17) ./mvnw -pl dolphinscheduler-task-plugin/dolphinscheduler-task-api -am -Dtest=ProcessUtilsTest -Dsurefire.failIfNoSpecifiedTests=false clean test ``` Result: `Tests run: 8, Failures: 0, Errors: 0`. ```bash git diff --check ``` Result: passed. -- 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]
