Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
When you initialize a form with many children (either direct children or deep descendants), a FormTree is initialized for each one recursively eagerly. The initialization happens in the next loop, but when it starts it happens synchronously, making the main thread unresponsive. If the data is big enough, the browser crashes with error code "SIGILL", which seems to be a memory issue.
This commit seem to suggest that it shouldn't happen that way: 98c5afd. Rather, since none of the children have any validations, or are accessed in anyway, I expect Angular not to create the FormTree for the children. In this case, the form will just keep a reference to the big array.
On the surface, you might think that this is not a valid usecase form should represent the user edited model. But you can think of situations in which a user import data (via a file upload for example) which becomes part of the model of the form, and might be saved etc. In this case and similar it's unnatural and creates extra work to separate the array from the form model (especially if you need validations on the array level (like length), even if you don't need it for the internal values)
Please provide a link to a minimal reproduction of the bug
https://github.com/ShacharHarshuv/angular-form-bug
Please provide the exception or error you saw
Browser crashes with SIGILL error, it looks like an out of memory issue. In less extreme situation, it doesn't crash but a lot of memory is used, and the main thread is stuck.
Please provide the environment you discovered this bug in (run ng version)
Anything else?
Angular CLI : 22.1.7
Angular : 22.1.5
Node.js : 24.18.0
Package Manager : npm 11.16.0
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.7 │ ^22.1.7 │
│ @angular/cli │ 22.1.7 │ ^22.1.7 │
│ @angular/common │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler-cli │ 22.1.5 │ ^22.1.0 │
│ @angular/core │ 22.1.5 │ ^22.1.0 │
│ @angular/forms │ 22.1.5 │ ^22.1.0 │
│ @angular/platform-browser │ 22.1.5 │ ^22.1.0 │
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
When you initialize a
formwith many children (either direct children or deep descendants), a FormTree is initialized for each one recursively eagerly. The initialization happens in the next loop, but when it starts it happens synchronously, making the main thread unresponsive. If the data is big enough, the browser crashes with error code "SIGILL", which seems to be a memory issue.This commit seem to suggest that it shouldn't happen that way: 98c5afd. Rather, since none of the children have any validations, or are accessed in anyway, I expect Angular not to create the
FormTreefor the children. In this case, the form will just keep a reference to the big array.On the surface, you might think that this is not a valid usecase form should represent the user edited model. But you can think of situations in which a user import data (via a file upload for example) which becomes part of the model of the form, and might be saved etc. In this case and similar it's unnatural and creates extra work to separate the array from the form model (especially if you need validations on the array level (like length), even if you don't need it for the internal values)
Please provide a link to a minimal reproduction of the bug
https://github.com/ShacharHarshuv/angular-form-bug
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
Angular CLI : 22.1.7
Angular : 22.1.5
Node.js : 24.18.0
Package Manager : npm 11.16.0
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.7 │ ^22.1.7 │
│ @angular/cli │ 22.1.7 │ ^22.1.7 │
│ @angular/common │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler │ 22.1.5 │ ^22.1.0 │
│ @angular/compiler-cli │ 22.1.5 │ ^22.1.0 │
│ @angular/core │ 22.1.5 │ ^22.1.0 │
│ @angular/forms │ 22.1.5 │ ^22.1.0 │
│ @angular/platform-browser │ 22.1.5 │ ^22.1.0 │