github / github/copilot-cli

OOM crash (`JavaScript heap out of memory`) on long `--resume` sessions; crash dumps written into the user's cwd

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

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

area:context-memory area:sessions
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

Describe the bug
Summary

Copilot CLI 1.0.82 repeatedly dies with a V8 heap OOM during long resumed sessions. It crashed 3 times in ~14 hours for me, always at the 4 GiB heap cap.

Separately, the resulting Node diagnostic reports are written into the current working directory, so they land inside whatever git repo I'm working in and show up as untracked files.

Environment
Copilot CLI 1.0.82
Node v24.18.1
Platform linux x64 (glibc 2.39)
Invocation copilot --no-warnings --report-on-fatalerror --optimize-for-size --expose-gc copilot --resume
What happens
"event":   "Allocation failed - JavaScript heap out of memory"
"trigger": "OOMError"

Three crashes on 2 Sep 2026, all in resumed sessions:

Time (UTC) Heap used / limit RSS CPU (user s)
00:51:37 3.98 / 4.00 GiB 4.63 GiB 7833
03:08:30 3.99 / 4.00 GiB 4.75 GiB 4065
14:39:00 3.99 / 4.00 GiB 4.69 GiB 2785
Diagnostic detail

At crash, old_space alone accounted for 3.96 GiB of the 3.99 GiB used:

old_space:                3.96 GiB
code_space:               0.01 GiB
trusted_space:            0.01 GiB
large_object_space:       0.00 GiB

Nearly all of it is long-lived, survived-GC data — consistent with unbounded retention/a leak rather than a transient allocation spike. javascriptStack is "No stack." / Unavailable., as expected for an OOM abort.

All three crashes were --resume sessions with substantial CPU time behind them (46m–2h11m user CPU), which points at per-session state (conversation/tool history?) accumulating without bound. Heap is pinned right at the cap each time, and RSS exceeds it by ~0.6–0.75 GiB.

Impact
  1. Data/work loss — long sessions die abruptly once they get big enough. The practical ceiling appears to be session length, not task complexity.
  2. Repo pollution — because --report-on-fatalerror is set and Node writes reports relative to cwd, files like report.20260902.143900.310882.0.001.json appear inside the user's repository. They show as untracked in git status and are easy to commit by accident. A CLI shouldn't drop crash artifacts into arbitrary project directories.
Notes for Copilot debugging

The 4 GiB ceiling is not user-imposed:

  • NODE_OPTIONS is unset.
  • Host has 30 GiB RAM with ~9 GiB free at crash time — no system memory pressure.
  • Plain node on this host reports a 4.05 GiB default heap limit; node --optimize-for-size reports exactly 4.00 GiB, matching javascriptHeap.memoryLimit in every dump.

So the cap comes from the --optimize-for-size flag the CLI passes itself. The process aborts at a self-imposed ceiling while the machine still has memory to spare — worth considering whether that flag is right for long-lived sessions, though the underlying retention growth looks like the real bug.

Affected version

1.0.82

Steps to reproduce the behavior
  1. Start a Copilot CLI session in a git repo.
  2. Use it heavily / resume it over an extended period (mine ran for hours of CPU time).
  3. Session eventually aborts with the OOM above; a report.*.json appears in the repo root.
Expected behavior
  • Session memory should be bounded (evict/compact old history), or degrade gracefully instead of a hard abort.
  • Crash dumps should go somewhere tool-owned — e.g. ~/.copilot/logs/ or $TMPDIR — not the user's cwd. If cwd is intentional, it should be configurable.
Additional context

report.20260902.005137.422602.0.001.json

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện một phiên --resume dài với --report-on-fatalerror--optimize-for-size, sau đó kiểm tra báo cáo chẩn đoán Node đính kèm và hành vi của lịch sử phiên. Hoàn thành khi các phiên dài không còn tiếp tục tăng cho đến khi xảy ra OOM không thể khắc phục, và các báo cáo lỗi nghiêm trọng được ghi vào vị trí do công cụ sở hữu thay vì cwd của người dùng.

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

Đánh giá

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

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.