Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Angular Router auxiliary outlets can exhaust memory during SSR

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

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
44/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ệ
angular, typescript
Lĩnh vực
frontend, performance

Hướng nghiên cứu

Start in the Angular Router recognition flow around processChildren() and mergeEmptyPathMatches(), then reproduce the behavior with the linked router auxiliary-outlet OOM lab. Compare snapshot and query-property allocation for the documented route and request shapes; done means the SSR cases no longer exhaust memory while preserving route recognition.

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

Mô tả

area: router gemini-triaged
Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

No

Description

The processChildren() recognizes every outlet before mergeEmptyPathMatches() removes duplicate empty-path branches. Every snapshot created along the way also copies the complete query parameter map:

Object.freeze({ ...this.urlTree.queryParams });

A small route shape is enough:

export const routes: Routes = [
  {
    path: "shop",
    children: [{ path: "", children: [{ path: "", component: ShopPage }] }],
  },
  { path: "**", component: NotFound },
];

For example:

/shop/(a:/()//b:/()//...)?a&b&c&...

With 480 outlets and 1,377 distinct query names, the 7,873-byte request creates 1,926 snapshots and copies 2,652,102 query properties.

At 128 MiB:

Arm Bytes Outcome Snapshots Keys copied
Candidate 7,873 5/5 fatal 1,926 2,652,102
Equal-byte control 7,873 0/5 fatal 1,926 3,852
Query only 4,084 0/5 fatal 6 8,262
Outlets only 3,794 0/5 fatal 1,926 0

Neither dimension reaches the same result alone.

I also tested 8 KiB and 16 KiB request lines at different empty-path depths with an async canMatch.

The values below are the lowest concurrency that terminated the worker. For example, 5 means four concurrent requests survived and five reached the OOM boundary.

Request Depth 256 MiB 512 MiB 1,024 MiB
8 KiB 2 2 5 6–16
3 2 3 6
4 1 3 5
16 KiB 2 1 2 4
3 1 2 3
4 1 1 2

Without the async guard, concurrency did not help. The largest heaps I could terminate with a single request were:

Depth 8 KiB 16 KiB
1 survives 128 MiB 256 MiB
2 128 MiB 512 MiB
3 128 MiB 512 MiB
4 256 MiB 1,024 MiB

Depth is application-controlled, not attacker-controlled.

In this we don't need to use numeric parameters or matrix parameters are involved. Angular 22.2.0 already contains #70717.

Sharing one frozen query map per recognition attempt changed the main 8 KiB / 128 MiB case from 5/5 fatal to 0/5 and reduced the copied properties from 2,652,102 to 1,377.

Please provide a link to a minimal reproduction of the bug

See POC https://github.com/SkyZeroZx/angular-router-aux-outlet-oom-lab

Ngôn ngữ chính
TypeScript
Star
101k
Fork
28.1k
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
301

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 angular/angular

Tất cả issue của angular/angular

Issue tương tự

Thêm issue về TypeScript

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.