MCP卡住问题修复#466
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| "os/exec" | ||
| ) | ||
|
|
||
| func terminateCommand(cmd *exec.Cmd) error { |
There was a problem hiding this comment.
Medium: on non-Windows we still only kill the direct child process here. If an MCP launcher spawns a helper that inherits stdout (the same shape of failure this PR is addressing), readRPCResponseContext will return on ctx.Done(), but the blocked reader goroutine and the descendant process will both stay alive until that helper exits on its own. Repeated timeouts can therefore accumulate leaked goroutines/processes on Unix-like hosts. Consider launching the command in its own process group and terminating the whole group here, not just cmd.Process.
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.
背景
配置 MCP 后,首次对话会在 turn 开始前同步 MCP 工具列表。如果 MCP server 通过
npx启动时卡住,原逻辑会导致:cmd.exe,子node.exe可能残留并继续占用 stdout 管道修改
node.exe残留。syncExtensionTools对扩展内部超时做 best-effort 处理,只有 turn 本身被取消/超时时才中断对话。验证