Conversation
supervisor.shutdown() relied on os.killpg, which does not exist on Windows; the AttributeError fell through to proc.terminate(), which only kills the sh/pnpm wrapper and leaves the node.exe listener holding port 8420 after the session ends. Add a platform-aware _terminate_tree: POSIX signals the whole process group (unchanged), Windows uses taskkill /F /T against the wrapper PID — the /T tree walk is required because the wrapper's exit orphans the node child, and /F is required because the windowless node process ignores the graceful form. Verified on Windows 11: os.killpg absent, taskkill /F /T terminates the parent and the orphaned child. Fixes TencentCloud#1381
Collaborator
|
Thank you so much for your attention and contribution! We will arrange an internal review for this PR shortly, and all feedback will be shared right here in the discussion. |
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.
Description | 描述
Fixes #1381.
supervisor.shutdown()依赖os.killpg做进程组终止,但os.killpg在 Windows 上不存在。抛AttributeError后落到proc.terminate(),只杀掉sh/pnpm包装层,杀不到它启动的node.exe子进程 —— 于是 Gateway 在会话结束后残留,继续占用 8420 端口,下个会话撞到被占用的端口。修复:新增平台感知的
_terminate_tree——os.killpg信号整个进程组(行为不变)。taskkill /F /T(/T走子进程树)。/F是必须的——实测发现温和的taskkill /T只对有窗口消息循环的进程有效,而无窗口的node.exe会被跳过(报 "can only be terminated forcefully")。Related Issue | 关联 Issue
Fixes #1381
Change Type | 修改类型
Self-test Checklist | 自测清单
Additional Notes | 其他说明
os.killpg不存在;确认taskkill /F /T能终止"父进程 + 其子进程"的整棵树(rc=0,双方进程均消失);确认温和的taskkill /T(不带 /F)对无窗口进程无效。