Angular Router numeric query parameters can exhaust memory during SSR
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/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ệ
- angular, node.js, typescript
- Lĩnh vực
- backend, performance, web-dev
Hướng nghiên cứu
The bug is in parseQueryParam() in the Angular Router package. Start by examining the router source code, particularly the query parameter parsing logic. The provided reproduction repository shows the memory issue during SSR. Look at how numeric query parameter names are handled differently in V8. Test changes by running the reproduction and verifying memory usage does not spike with numeric parameters.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
#70717 fixed the numeric matrix-parameter case from #70716, but query parameters still use regular object assignment in parseQueryParam():
params[decodedKey] = decodedVal;
Numeric query parameter names therefore still behave differently in V8.
For example:
?0&17&34
is parsed as:
{
"0": "",
"17": "",
"34": ""
}
In my test this object retained around 558 KB, while a similar nonnumeric control retained around 197 KB.
The Router copies this map when creating URLs. An application can enable this globally with:
withRouterConfig({
defaultQueryParamsHandling: 'merge',
})
so during SSR the cost is repeated for every RouterLink rendered on the page.
I tested Angular 22.2.0 on Node.js 24 through Nginx with a 16,365-byte request line containing 2,827 parameter names:
| Links | 256 MiB | 512 MiB |
|---|---|---|
| 30 | 16 requests | |
| 50 | 8 requests | 20 requests |
| 75 | 6 requests | 12 requests |
| 100 | 4 requests | 10 requests |
The byte-identical nonnumeric control completed successfully.
For comparison, the original matrix-parameter case on Angular 22.1.4 also required 4 requests at 256 MiB and 10 requests at 512 MiB with 100 links.
All failures were V8 heap OOMs:
OOMKilled=false
Please provide a link to a minimal reproduction of the bug
https://github.com/SkyZeroZx/angular-router-ssr-oom-lab/tree/query-param-oom-angular-22.2.0
- Ngôn ngữ chính
- TypeScript
- Star
- 101k
- Fork
- 28.1k
- Merge trung bình
- 2 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 307
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 angular/angular
-
area: docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
area: forms forms: signals
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
area: docs gemini-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
area: forms forms: signals
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
area: docs area: forms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Tất cả issue của angular/angular
Issue tương tự
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100