github / github/copilot-cli

`--server --stdio` never releases a session's extension-host processes; they accumulate at 4 per session until the server exits

Aperta
#4,468 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

area:platform-windows area:sessions
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

[Filed by Copilot on behalf of @bghgary]

Summary

When copilot.exe runs as a long-lived server (--server --stdio, as the Windows desktop app hosts it), each session it creates spawns four extension-host child processes, and none are terminated when the session ends. They are released only when the whole server process exits.

Over ~3 hours of repeated short-lived sessions this reached 192 extension-host processes holding ~13 GB of working set on an otherwise idle machine.

Expected vs actual

  • Expected: a session's extension hosts exit when that session ends.
  • Actual: they persist for the lifetime of the server process. The count only ever grows.

Evidence

Extension hosts are copilot.exe processes whose command line ends in preloads\extension_bootstrap.mjs. Their command lines are byte-identical to one another, so they carry no session identity.

Two server processes on the same machine, measured together:

Server Sessions Hosts
Hosting 3 long-lived interactive sessions 3 12, stable for hours
Creating repeated short-lived sessions 44 created since start 180

The first is exactly 4 per live session and never grew. The second matches 4 per session to within one session, and not one host from a completed session had exited — sessions reporting status completed leaked identically to any other.

A third control: a one-shot invocation (copilot -p "...") leaks zero. Host count before and after is identical, so the defect appears only in server mode.

Each host is ~70 MB of working set and effectively idle (~2 s of CPU accumulated over 3 hours), so this is a pure resource leak rather than runaway work.

Reproduction

  1. Run the Windows desktop app, which hosts copilot.exe --server --stdio.
  2. Have it create repeated short-lived sessions — scheduled workflows do this on a timer.
  3. Count copilot.exe processes whose command line contains extension_bootstrap.

The count rises by 4 per session and never falls. Restarting the app is the only thing that clears them.

Impact

Host count grew at ~48/hour, reaching 192 processes and ~13 GB before intervention. Memory pressure was the visible symptom.

Workaround

Kill surplus hosts on a timer, keeping the newest N per server process — an in-flight session's hosts are always the newest, so they are never candidates. This is a hack; there is no supported way to map a host back to its session.

Environment

  • Copilot CLI 1.0.79-9
  • GitHub Copilot desktop app 1.1.8
  • Windows 11 build 26310

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso --server --stdio e dal ciclo di vita della sessione che avvia preloads\\extension_bootstrap.mjs; riproduci la perdita creando ripetutamente sessioni di breve durata e contando i processi copilot.exe corrispondenti. Il lavoro è completato quando i quattro host delle estensioni di ogni sessione terminano alla fine della sessione, mentre le sessioni di lunga durata mantengono i propri host e le invocazioni one-shot continuano a non causare alcuna perdita.

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

Valutazione

Stack tecnologico
javascript
Ambito
backend, cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.