coder / coder/internal

Probable go routine leak with mcp-server

Aperta
#939 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
3
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Non sono indicati file o test del repository. Inizia individuando l’integrazione del server MCP in coderd, riproduci traffico MCP sostenuto e confronta i profili delle goroutine durante l’intero ciclo di vita del server; il lavoro è completato quando la perdita è confermata o esclusa, con una causa chiaramente identificata e prove a supporto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.