Repository navigation
Conversation
5 处失败/过期路径统一语义:transport.close() 成功才 connections.delete; close 抛错保留登记 + suppressReconnect 防重连,孤子进程由退出时的 killChildrenSync() 回收(此前提前摘除登记导致 PPID=1 孤儿残留)。 Closes huiliyi37#432
…品 PR huiliyi37#436 的失败完全一致,且都与本改动无关)
huiliyi37
added a commit
that referenced
this pull request
Oct 10, 2026
内容已经 sync 流程合入(dev 收编记录:未检索到),本提交为作者署名落账(提交页归属)。 Co-authored-by: Ver-zhzh <225828202+Ver-zhzh@users.noreply.github.com>
huiliyi37
pushed a commit
that referenced
this pull request
Oct 10, 2026
Owner
|
已通过 sync 流程合入 dev,感谢 @Ver-zhzh 的贡献 🎉 本 PR 的改动(fix(mcp): close 成功才摘除连接登记,杜绝孤儿子进程)已经 sync 流程合入主仓(本次 sync),并已收录进 CONTRIBUTORS.md。 按仓库的双仓流程,公开仓 PR 不经 merge 按钮合入(保持 dev 主仓唯一事实源),现以 sync-merged 标记关闭。欢迎继续贡献! |
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 close 失败路径提前摘除登记导致孤儿子进程
1. close 成功才摘除 connections 登记
现象:McpManager 在 5 处失败/过期路径上先(或无条件)
connections.delete(serverId)、后 best-efforttransport.close();close 抛错后连接已失登记,killChildrenSync() 无法回收。根因:src/mcp/manager.ts —— ①
_connectServer后 generation 过期分支 close 前从不登记(最严重,子进程已 spawn);② inventory block 分支 delete 先于 close;③/④ tool discovery 失败分支与 _discoverTools 后 generation 过期分支 close 后无条件 delete;⑤shutdownServerclose 后无条件 delete。修复:统一语义——
transport.close()成功才connections.delete(serverId);close 抛错时保留登记并suppressReconnect.add(serverId)防重连,孤子进程在进程退出时由killChildrenSync()回收。仅改 src/mcp/manager.ts 一处(+43/-8)。未修观察(如实报告,非本批引入)
验证
Closes #432