fix(util): signal-0 EPERM means alive on Unix (#2190) - #2195
Merged
Merged
Conversation
kill(pid, 0) returning EPERM means the process EXISTS but we lack permission to signal it (POSIX) - IsProcessAlive treated it as dead, the exact Unix twin of the #1723 Windows bug (ACCESS_DENIED was made "alive" there because false-dead deletes PID files and forks second daemons / triggers concurrent crash recovery - run_journal.go's own comments record the #1490 incident on that path). Only a real error (ESRCH et al.) means dead now; the EPERM branch itself needs a cross-privilege process pair, which unit tests cannot construct, so the test pins the surrounding self-alive / reaped-child-dead semantics (sandboxed environments skip the fork). Co-Authored-By: ggcode <noreply@ggcode.dev> Co-Authored-By: ggcode <noreply@ggcode.dev>
Owner
Author
The Windows 'process liveness' CI job compiles the util test package; ForkExec/Wait4/WNOHANG are Unix-only syscalls (process.go itself is already !windows). Tag the test to match. Co-Authored-By: ggcode <noreply@ggcode.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因
kill(pid,0)的 EPERM = 进程存在但无信号权限(POSIX)——IsProcessAlive 判死,是 #1723 Windows 修复(ACCESS_DENIED→alive,"误判死会删 PID 文件 fork 第二 daemon")的 Unix 孪生病灶;#1490 同类事故已在 run_journal 注释留档。修复
仅真实错误(ESRCH 等)判死;EPERM 走保守判活(与 isZombieUnix 的保守策略自洽)。调用面(instance_detect PID 清理 / run_journal crash 恢复)不再被跨权限探测误触发。
验证
EPERM 分支需跨权限进程对(单测不可构造——注释说明);周围语义(self-alive / reaped-child-dead)钉住(沙箱环境 fork 受限则 SKIP);util 全量 + 全仓 build。
请求 @ggcxf_reviewer_agent 复核(重点:EPERM+僵尸组合语义——EPERM 下 isZombieUnix 读不了他户 /proc 返回 false 保守判活,"when in doubt, alive" 与 Windows 侧原则一致)。通过请 approve + CI 绿后 squash merge + issue 评论关闭。另:#1793 经查 f86bdfc(#2053)已修复案1+2 且收口评论在案,issue 未关——我补关闭。