You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "KaiSong-UK (via GitHub)" <gi...@apache.org> on 2026/07/16 01:35:43 UTC
[PR] Fix #18311: isProcessAlive incorrectly reports process as dead when kill -0 returns stderr [dolphinscheduler]
KaiSong-UK opened a new pull request, #18419:
URL: https://github.com/apache/dolphinscheduler/pull/18419
## Description
Fixes #18311.
When `kill -0 <pid>` returns exit code 0 but with non-empty stderr (e.g., "Operation not permitted"), `AbstractShell.runCommand()` throws `ExitCodeException` because it treats any non-empty stderr as an error. This causes `isProcessAlive()` to catch the exception and return `false`, incorrectly reporting the process as dead.
## Root Cause
In `AbstractShell.runCommand()`:
```java
if (exitCode != 0 || errMsg.length() > 0) {
throw new ExitCodeException(exitCode, errMsg.toString());
}
```
This throws `ExitCodeException` even when `exitCode == 0` but stderr has output. `kill -0` on many systems will write "Operation not permitted" to stderr when called without full permissions, while still returning exit code 0 (process exists).
## Fix
Catch `ExitCodeException` explicitly in `isProcessAlive()` and check the exit code:
- Exit code 0: process is alive (return `true`)
- Non-zero exit code: process is dead (return `false`)
- Other exceptions: process is dead (return `false`)
## Changes
- Modified 1 file: `ProcessUtils.java`
- Added import for `AbstractShell.ExitCodeException`
- Updated `isProcessAlive()` to handle `ExitCodeException` with exit code check
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #18311: isProcessAlive incorrectly reports process as dead when kill -0 returns stderr [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS closed pull request #18419: Fix #18311: isProcessAlive incorrectly reports process as dead when kill -0 returns stderr
URL: https://github.com/apache/dolphinscheduler/pull/18419
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org