github / github/copilot-cli

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

未关闭
#4,468 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:platform-windows area:sessions
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

[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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

--server --stdio 入口点以及启动 preloads\\extension_bootstrap.mjs 的会话生命周期开始;通过反复创建短生命周期会话并统计匹配的 copilot.exe 进程来复现泄漏。完成标准是每个会话的四个扩展主机在会话结束时退出,而长生命周期会话保留其主机,并且单次调用仍然不会产生任何泄漏。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
backend, cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。