-
Notifications
You must be signed in to change notification settings - Fork 36
fix: mcp mem leak #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: mcp mem leak #329
Conversation
WalkthroughA line was added to the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MCPControllerRegister
participant sseConnections
Client->>MCPControllerRegister: Open SSE transport
MCPControllerRegister->>sseConnections: Store session ID
Client--xMCPControllerRegister: Close SSE transport
MCPControllerRegister->>sseConnections: Delete session ID
MCPControllerRegister->>transports/sseTransportsRequestMap: Cleanup
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
plugin/controller/lib/impl/mcp/MCPControllerRegister.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-eggache". (The package "eslint-plugin-eggache" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-eggache" was referenced from the config file in ".eslintrc » eslint-config-egg/typescript » ./index.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
plugin/controller/lib/impl/mcp/MCPControllerRegister.ts (1)
382-387
: Ensure immediate cleanup of the SSE keepalive interval on transport closeDeleting the
sseConnections
entry stops future heartbeats, but the interval timer continues until the next tick. To fully prevent resource leaks, clear the storedintervalId
immediately in theonclose
handler before removing the map entry.Proposed diff:
transport. => { closeFunc?.(...args); delete self.transports[transport.sessionId]; self.sseTransportsRequestMap.delete(transport); + // clear the heartbeat interval immediately + const conn = self.sseConnections.get(transport.sessionId); + if (conn) clearInterval(conn.intervalId); self.sseConnections.delete(transport.sessionId); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
plugin/controller/lib/impl/mcp/MCPControllerRegister.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Runner-macos (16)
- GitHub Check: Runner-macos (18)
- GitHub Check: Runner-ubuntu (20)
- GitHub Check: Runner-ubuntu (22)
- GitHub Check: Runner-ubuntu (18)
- GitHub Check: Runner-ubuntu (16)
- GitHub Check: Runner-macos (20)
- GitHub Check: Analyze (typescript)
- GitHub Check: Analyze (javascript)
@coderabbitai 创建 issues 跟进此修复会被合并到 next 分支 |
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@fengmk2 我已经创建了一个 GitHub issue 来跟进此 MCP 内存泄漏修复合并到 next 分支的进度。这个 issue 将帮助跟踪修复的合并状态和验证内存泄漏问题是否已彻底解决。 🏁 Script executed:
Length of output: 562 @fengmk2 已成功创建 GitHub issue #330 来跟进此 MCP 内存泄漏修复合并到 next 分支的进度。 Issue 链接: #330 这个 issue 包含了:
您可以通过这个 issue 来跟踪修复的合并状态和验证内存泄漏问题的解决情况。 |
Checklist
npm test
passesAffected core subsystem(s)
Description of change
Summary by CodeRabbit