v26: computed property lookups with concatenated keys that miss keep every key alive (unbounded heap growth)
Maintainer thường phản hồi trong vòng 1 ngày
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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
The report isolates the issue to V8 keyed property loads for missing properties when the key is freshly concatenated, and includes a reproducible script and heap snapshot evidence. Start by running the supplied script on Node 26 and a version where the heap stays flat, then inspect keyed-load feedback and the FeedbackVector/FeedbackCell retention described in the report. Done means missed concatenated-key lookups no longer retain every key and the heap remains flat after garbage collection.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
v26.13.1 (V8 14.6.202.34-node.40). Also reproduced on v26.5.0. Also observed on Linux with v26.10.0.
Platform
Darwin arm64 (macOS); also Linux
Subsystem
V8
What steps will reproduce the bug?
A computed property load on a plain object, where the key is a freshly concatenated string and the property is absent, keeps every such key reachable for the life of the process. Heap grows without bound.
// node --expose-gc repro.mjs [concat|plain|hasOwn]
const table = {};
for (let i = 0; i < 300; i++) table[`key-${i}`] = i;
const lookups = {
concat: (s) => table[s + ".x"], // grows without bound on Node 26
plain: (s) => table[s], // stable
hasOwn: (s) => Object.hasOwn(table, s + ".x"), // stable
};
const lookup = lookups[process.argv[2] ?? "concat"];
const heapMB = () => {
globalThis.gc();
return Math.round(process.memoryUsage().heapUsed / 1048576);
};
console.log(process.version, process.argv[2] ?? "concat", "start", heapMB(), "MB");
for (let round = 1; round <= 8; round++) {
for (let i = 0; i < 400_000; i++) lookup(`some/unique/string-${Math.random()}-${i}`);
console.log("after", round * 400_000, "misses:", heapMB(), "MB");
}
How often does it reproduce? Is there a required condition?
Every time on v26.x. The key has to come from a concatenation (s + ".x") and miss on the object. With a pre-existing string key (table[s]), Object.hasOwn, in or Map#has, the heap stays flat.
What is the expected behavior? Why is that the expected behavior?
Heap after gc() stays flat. That is what v20.20.2, v22.22.3, v24.15.0 and v24.18.0 (V8 13.6) do with the same script:
v24.18.0 concat start 3 MB
after 3200000 misses: 3 MB
What do you see instead?
v26.13.1 concat start 4 MB
after 400000 misses: 69 MB
after 800000 misses: 133 MB
after 1200000 misses: 182 MB
after 1600000 misses: 263 MB
after 2000000 misses: 312 MB
after 2400000 misses: 361 MB
after 2800000 misses: 474 MB
after 3200000 misses: 523 MB
plain and hasOwn stay at 3–4 MB on v26.13.1.
Additional information
In a heap snapshot, the retained key strings hang off large arrays (about 8 MB each, one per lookup site) that are referenced from the lookup function's FeedbackVector / FeedbackCell. So the keyed-load feedback seems to keep its keys strongly.
This shows up in practice in long-running HTTP servers. For example, a static-file check like assets[path + '.gz'] || assets[path + '.br'] running on every request turns every distinct request URL into permanent heap. We saw about 13 MB/h of growth, and processes got OOM-killed after a couple of days. Our workaround was to switch those lookups to Object.hasOwn.
- Ngôn ngữ chính
- JavaScript
- Star
- 124k
- Fork
- 38k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 266
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fs: document readStream.start and readStream.endCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
nodejs/node#67848 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
doc: document the Buffer.prototype.*Slice() methodsCó thể đã có người làm @AyushCipher đã nhận hôm nay. Đang mởdoc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
nodejs/node#67847 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`styleText` fast path bypasses `options` and `options.validateStream` validationCó thể đã có người làm @GBra-4-669 đã nhận 8 ngày trước. Đang mởutil
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
riscv64
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nodejs/node#67655 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug triage needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Resource]: PersephoneĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
hesreallyhim/awesome-claude-code#3773 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
tabatkins/railroad-diagrams#129 ·
-
web: api() turns a null or object-valued error body into a TypeError or "[object Object]" and loses the statusCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OCM: shares using the `embedded` protocol are rejected with "Missing sharedSecret in protocol"Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày