Repository navigation
fix: Windows 上信号名退化成 SIG11 - #117
Merged
Merged
Conversation
上一版把信号表改成「只按 pcntl 常量解析」,但 Windows 没有 pcntl,
defined('SIGSEGV') 等全为 false,映射表为空,日志里变成 signal=11(SIG11),
WorkerCrashGuardTest 的两条用例在 windows-latest 上失败(master 变红)。
改为「跨平台兜底表 + 平台常量覆盖」:
- 兜底表只收 Linux 与 macOS 编号一致的信号(1/2/3/4/5/6/8/9/11/13/14/15/24/25),
Windows 上靠它仍能给出 SIGSEGV / SIGKILL 等可读名字;
- 不再把 SIGBUS / SIGUSR1 / SIGUSR2 放进兜底表(各平台编号不同),
继续由 defined() 常量按当前平台覆盖。
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.
问题
#116 合并后 master 的 Test workflow 变红,只有 windows-latest 全挂(8.1/8.2/8.3/8.4),Linux/macOS 全绿:
原因:上一版把信号表改成「只按
pcntl常量解析」,而 Windows 没有 pcntl,defined('SIGSEGV')全为false→ 映射表为空 → 退化成SIG11。修复
改成「跨平台兜底表 + 平台常量覆盖」:
1/2/3/4/5/6/8/9/11/13/14/15/24/25,Windows 上靠它仍能给出SIGSEGV/SIGKILL这类可读名字;SIGBUS/SIGUSR1/SIGUSR2不进兜底表(各平台编号不同:Linux SIGBUS=7、SIGUSR1=10;macOS SIGBUS=10、SIGUSR1=30),继续由defined()常量按当前平台覆盖。这样既修掉 Windows,又保留上一轮「Linux 上不再把 SIGUSR1 误报成总线错误」的效果。
验证
phpunit --filter WorkerCrashGuardTest:4 tests / 53 assertions OK--enable-pcntl编译进去的)