coder / coder/internal

Probable go routine leak with mcp-server

Open
#939 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Library: https://github.com/mark3labs/mcp-go

> [!NOTE]
> Grafana links might expire, so images are also included. All graphs, unless otherwise specified are capturing the "last 12 hours". Roughly `2025-08-25 09:41:18 -> 2025-08-26 09:41:18` CDT

There is a potential go routine leak with the mcp server. This was first noticed as a memory leak in grafana, and then drilled down to being caused by go routines.

The initial memory leak chart: snapshot. It does not look terrible, but an obvious upward trend is present.
Image

Tracking go routine count per service in coderd. The go routine count for `http-api` nearly doubles from 1.7k to 3.2k over 2 hours.
Image

There is increase in go routines that seems to correlate with the MCP traffic. Note this is over the last 16 hours.

Image

Here is a profiling drilldown comparing part of the go routine leak to a later moment. MCP sticks out.

Image

This seems to have been an issue for the mcp server in the past: https://github.com/mark3labs/mcp-go/issues/555

> As early adopters of MCP-Go, we ran into a few challenges around quality and reviews that we initially assumed were part of the bootstrapping phase. In particular, we’ve occasionally encountered leaks and regressions

----

It is hard to tell for sure because Coderd restarts so often. So the go routines always come down from a reboot, rather than reduced traffic.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.