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 OAuth transports not closed on retry or cancellation · Issue #9153 · anomalyco/opencode

Memory leak: MCP OAuth transports not closed on retry or cancellation #9153

New issue
Copy link
New issue
Copy link
Closed
Closed
Memory leak: MCP OAuth transports not closed on retry or cancellation#9153
Copy link
Assignees
rekram1-node
Labels
perfIndicates a performance issue or need for optimization

Description

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

Problem

When MCP OAuth flows are initiated, transports are stored in pendingOAuthTransports Map. These transports are never closed when:

  1. OAuth retry - A new transport is created for the same server, orphaning the previous one
  2. OAuth cancellation - removeAuth() deletes the map entry but doesn't close the transport
  3. OAuth timeout - Incomplete flows leave open transports

Additionally, when the main OpenCode process terminates, spawned MCP server processes may continue running as orphans.

Code Location

packages/opencode/src/mcp/index.ts

Impact

  • Open connections accumulate over OAuth retries
  • Orphaned MCP server processes after OpenCode exits
  • Memory growth in long-running sessions

Relates to #5363

Expected Behavior

  • Old transports should be closed before creating new ones
  • removeAuth() should close transport before deletion
  • Process exit should clean up all MCP clients

Activity

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

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

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

    • [Bug] MCP processes not terminated after session ends #6633: [Bug] MCP processes not terminated after session ends
    • 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

    Both of these issues describe similar symptoms of orphaned MCP server processes and memory leaks that appear directly related to the transport cleanup problems described here.

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

  4. github-actions commented on Mar 27, 2026

    @github-actions
    github-actionsBot
    on Mar 27, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. github-actions
    closed this as completedon Mar 27, 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.