fix(acp): Fix memory leak in session event streams#9146
fix(acp): Fix memory leak in session event streams#9146sauerdaniel wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
a4a5836 to
fd46aee
Compare
|
Rebased onto latest dev and resolved merge conflicts.\n\nChanges adapted to the current architecture:\n- Added |
8fa9ddc to
f126b34
Compare
f126b34 to
ec0c301
Compare
Add cleanup mechanism for ACP session map and event streams to prevent unbounded growth. Implements proper session lifecycle management.
ec0c301 to
2cd03ac
Compare
Addresses the remaining memory leaks identified in anomalyco#16697 by consolidating the best fixes from 23+ open community PRs into a single coherent changeset. Fixes consolidated from PRs: anomalyco#16695, anomalyco#16346, anomalyco#14650, anomalyco#15646, anomalyco#13186, anomalyco#10392, anomalyco#7914, anomalyco#9145, anomalyco#9146, anomalyco#7049, anomalyco#16616, anomalyco#16241 - Plugin subscriber stacking: unsub before re-subscribing in init() - Subagent deallocation: Session.remove() after task completion - SSE stream cleanup: centralized cleanup with done guard (3 endpoints) - Compaction data trimming: clear output/attachments on prune - Process exit cleanup: Instance.disposeAll() with 5s timeout - Serve cmd: graceful shutdown instead of blocking forever - Bash tool: ring buffer with 10MB cap instead of O(n²) concat - LSP index teardown: clear clients/broken/spawning on dispose - LSP open-files cap: evict oldest when >1000 tracked files - Format subscription: store and cleanup unsub handle - Permission/Question clearSession: reject pending on session delete - Session.remove() cleanup chain: FileTime, Permission, Question - ShareNext subscription cleanup: store unsub handles, cleanup on dispose - OAuth transport: close existing before replacing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Summary
Fix ACP session resource cleanup to prevent stale session state and leaked per-session resources.
Fixes #9154
Relates to #5363
Problem
ACP sessions were not fully cleaned up when sessions were deleted, leaving stale entries in session maps and per-session permission queues.
Solution
Changes
Testing
AI-Assisted
Yes