fix: 增加 Worker 进程孤儿检测以应付 Runner 进程的异常退出#1459
Closed
Ronifue wants to merge 0 commit intoMai-with-u:devfrom
Closed
Conversation
Contributor
Author
|
还有在此向 @HyperSharkawa 道个歉,我重新看了一下我昨晚在那个 Pr 里面的评论 #1445 ,我的措辞不仅夹杂的莫名其妙的人身攻击,而且非常不理智。 我承认我有时候说话确实不过脑子,同为项目的贡献者,你也是来贡献代码的,你的回复没有问题,我不应该用那样情绪化的语言质疑你的回复,这是我的问题,在此向你致歉,我绝不希望我的态度成了阻碍项目变好的绊脚石。 无论你是否决定继续为MaiBot贡献代码,我都感谢你之前的 fix 尝试和提出的看法、找到的问题,它至少帮助大家找到了一个方向。 Respect |
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.
main分支 禁止修改,请确认本次提交的分支 不是main分支请填写破坏性更新的具体内容(如有):
请简要说明本次更新的内容和目的:修复 Runner 进程非正常终止(SIGKILL/SIGTERM)时 Worker 进程残留的问题
需要提到几个潜在的边缘情况就是(要是遇到了就去买彩票吧):
如果 Worker 进程的主线程被阻塞,导致 SIGINT 无响应(当然这一般不太可能),而我调用的是
graceful_shutdown,孤儿 Worker 进程就退出不了了,那就不是我的锅了,用户自己去 KILL 吧(如果用户的 Windows 环境权限极度受限,连 OpenProcess 都无法调用来获取父进程句柄(尽管是父子关系),Worker 就会触发 Fail-safe 机制直接退出
Windows 上更罕见的边缘情况就是,旧的 Runner 进程刚死,新进程立马占用了同一个 PID,也就是说要同时满足:
GetExitCodeProcess时仍返回STILL_ACTIVE那我也没招,这种神秘情况怎么可能发生(