nodejs / nodejs/node

node process killed by os during heap snapshot due to OOM

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

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

never-stale
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.4k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
272

Mô tả

Version

v20.9.0

Platform

linux 6.2.7-060207-generic

Subsystem

No response

What steps will reproduce the bug?
const memoryHog = [];

setInterval(async () => {
  const mem = process.memoryUsage();
  console.log(mem);
  memoryHog.push(new Array(20000000).fill({ foo: Date.now() }));
}, 5000);
node --heapsnapshot-near-heap-limit=800 --max-old-space-size=1000 script.js
How often does it reproduce? Is there a required condition?

It always happens

What is the expected behavior? Why is that the expected behavior?

I expected node to generate a heap snapshot when the memory usage approached the specified limit, allowing analysis of memory allocation before the process was terminated duo to heap OOM

What do you see instead?

Node uses all of the host system resources, and the Node process is killed by the operating system before a heap snapshot can be generated, preventing analysis of the memory usage pattern that leads to the crash.

Additional information

I have 16GB of ram and it should be enough to generate a heap snapshot of a node process with 1GB use of heap

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

Tái hiện vấn đề với script.js bằng node --heapsnapshot-near-heap-limit=800 --max-old-space-size=1000 và quan sát mức sử dụng bộ nhớ trước khi tiến trình bị kết thúc. Bắt đầu bằng cách lần theo hành vi của heap-snapshot-near-heap-limit trong Node.js; được xem là hoàn tất khi tiến trình có thể tạo heap snapshot như mong đợi trước khi hệ điều hành kết thúc tiến trình.

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, linux, node.js
Lĩnh vực
performance
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
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
55/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.