GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Memory leak: MCP clients not closed before reassignment · Issue #8257 · anomalyco/opencode

Memory leak: MCP clients not closed before reassignment #8257

New issue
Copy link
New issue
Copy link
Closed
#8253
Closed
Memory leak: MCP clients not closed before reassignment#8257
#8253
Copy link
Assignees
rekram1-node
Labels
perfIndicates a performance issue or need for optimization

Description

@sauerdaniel
sauerdaniel
opened on Jan 13, 2026
Issue body actions

Description

When MCP clients are reassigned in MCP.add() or during OAuth finishAuth(), the existing client at that key is silently overwritten without being closed first.

Impact

  • Open connections/sockets are orphaned
  • Active event listeners accumulate
  • Resources are never released
  • Contributes to memory growth in long-running sessions

Location

packages/opencode/src/mcp/index.ts - two locations where s.clients[name] = result.mcpClient overwrites existing clients

Reproduction

  1. Connect to an MCP server
  2. Reconnect or complete OAuth flow
  3. Previous client is leaked

Related

Part of #3013 (general memory issues)
Related to #7261 (MCP orphan processes)

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jan 13, 2026
  2. github-actions
    added
    perfIndicates a performance issue or need for optimization
    on Jan 13, 2026
  3. github-actions commented on Jan 13, 2026

    @github-actions
    github-actionsBot
    on Jan 13, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • v1.1.6 still has memory bloat - heap not released + MCP orphan processes #7261: v1.1.6 still has memory bloat - heap not released + MCP orphan processes (closely related - discusses MCP process leaks)
    • [Bug] MCP processes not terminated after session ends #6633: [Bug] MCP processes not terminated after session ends (addresses MCP cleanup on session exit)
    • Uses a huge amount of memory #3013: Uses a huge amount of memory (general memory accumulation issues)

    Feel free to ignore if none of these address your specific case.

  4. rekram1-node
    closed this as completedin #8253on Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.