copilot-runtime memory keeps growing when large sessions are resumed and disconnected

Đang mở
#2,889 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, macos
Lĩnh vực
performance

Hướng nghiên cứu

The report describes memory that is not released after a resumed session is disconnected, and it gives a repro using CopilotClient, a copied session with a large events.jsonl, and footprint -p on the runtime pid. Start with the resume and disconnect path in the SDK, then look for where the replayed session history is kept after disconnect. Done means memory returns near its baseline after repeated resume/disconnect rounds, shown by a repro that stays flat.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • SDK: @github/copilot-sdk 1.0.27-unstable.40031404408.gba6c003 (the one bundled with VS Code 1.144.0)
  • copilot-runtime: 1.0.100-1
  • OS: macOS 27.0, arm64

My Mac (16 GB) ran out of memory. macOS showed the Force Quit window, but the mouse and screen stopped responding, so I had to hard reboot it. In the jetsam report, two copilot-runtime processes from VS Code's agent host held 12.8 GB (up about 8 days) and 8.0 GB (up about 3 days). Something else started the actual OOM, but those two were already using more than half the RAM.

Some of my chats are long, with events.jsonl between 150 and 450 MB. So I tried to see where the memory goes. I used the SDK on its own (CopilotClient with a separate home directory and copies of my sessions) and measured with footprint -p on the runtime pid:

  • Resuming a session costs about 3 times its events.jsonl: 15 MB file → +100 MB, 250 MB → +750 MB, 439 MB → +1.37 GB.
  • After I disconnect the session, the memory doesn't come back. With all three resumed and then disconnected, the runtime stayed at 727 MB.
  • Resuming and disconnecting the 250 MB session 14 times in a row: the footprint grew by about 46 MB each time and never came down. The same loop with the 15 MB session stayed flat over 20 rounds.

The agent host log for the 8 GB process had 55 "Evicting idle session" lines and 108 resumes. That adds up to about 7 GB of events.jsonl read back over 3 days. My guess is that each resume of a large session leaves part of the replayed history behind, and evicting an idle session and resuming it later doesn't free it. I may be wrong about the cause, but the numbers above reproduce for me every time.

Steps to reproduce
  1. Take a session with a large events.jsonl (a couple hundred MB).
  2. With the SDK, start a client, then resume and disconnect that session in a loop.
  3. Watch footprint -p <copilot-runtime pid> after each round.

Expected: after a disconnect, memory goes back to roughly where it was.
Actual: it grows by tens of MB per round until the runtime is restarted.

For now I restart the agent host when it gets too big. That works because chats resume from disk.

Ngôn ngữ chính
Java
Star
10.7k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/copilot-sdk

Tất cả issue của github/copilot-sdk

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.