angular-cli: Call retries were exceeded. Allocation failed - JavaScript heap out of memory error on build
đ Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, the previous version in which this bug was not present was:@angular/cli 8.3.20 @angular-devkit/build-angular 0.803.20
Description
A clear and concise description of the problem...After updating to 8.3.21, when I run âng buildâ or âng build --prodâ the build reaches the âGenerating ES5 bundles for differential loadingâ stage. It then stops outputting information, and multiple report.xxx.json files (attached) are created, approximately 45 seconds apart.
Reverting back to 8.3.20 resolves this issue.
đŹ Minimal Reproduction
đ„ Exception or Error
[error] Error: Call retries were exceeded
at ChildProcessWorker.initialize (<My app directory>\node_modules\@angular-devkit\build-angular\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
at ChildProcessWorker.onExit (<My app directory>\node_modules\@angular-devkit\build-angular\node_modules\jest-worker\build\workers\ChildProcessWorker.js:263:12)
at ChildProcess.emit (events.js:210:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
đ Your Environment
Angular CLI: 8.3.21
Node: 12.13.1
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.21
@angular-devkit/build-angular 0.803.21
@angular-devkit/build-optimizer 0.803.21
@angular-devkit/build-webpack 0.803.21
@angular-devkit/core 8.3.20
@angular-devkit/schematics 8.3.20
@angular/cli 8.3.21
@ngtools/webpack 8.3.21
@schematics/angular 8.3.21
@schematics/update 0.803.21
rxjs 6.5.3
typescript 3.5.3
webpack 4.39.2
Anything else relevant?
Contents of a report file:
{
"header": {
"reportVersion": 1,
"event": "Allocation failed - JavaScript heap out of memory",
"trigger": "FatalError",
"filename": "report.20191230.175738.18688.0.001.json",
"dumpEventTime": "2019-12-30T17:57:38Z",
"dumpEventTimeStamp": "1577728658928",
"processId": 18688,
"cwd": "C:\\Horizon_Local\\RDT_Backlog\\LandscapeWeb\\LandscapeClaim\\trunk\\src\\Rdt.Landscape.Claim.Host\\ClientApp\\LandscapeClaim",
"commandLine": [
"C:\\Program Files\\nodejs\\node.exe",
"C:\\Horizon_Local\\RDT_Backlog\\LandscapeWeb\\LandscapeClaim\\trunk\\src\\Rdt.Landscape.Claim.Host\\ClientApp\\LandscapeClaim\\node_modules\\@angular-devkit\\build-angular\\node_modules\\jest-worker\\build\\workers\\processChild.js"
],
"nodejsVersion": "v12.13.1",
"wordSize": 64,
"arch": "x64",
"platform": "win32",
"componentVersions": {
"node": "12.13.1",
"v8": "7.7.299.13-node.16",
"uv": "1.33.1",
"zlib": "1.2.11",
"brotli": "1.0.7",
"ares": "1.15.0",
"modules": "72",
"nghttp2": "1.39.2",
"napi": "5",
"llhttp": "1.1.4",
"http_parser": "2.8.0",
"openssl": "1.1.1d",
"cldr": "35.1",
"icu": "64.2",
"tz": "2019c",
"unicode": "12.1"
},
"release": {
"name": "node",
"lts": "Erbium",
"headersUrl": "https://nodejs.org/download/release/v12.13.1/node-v12.13.1-headers.tar.gz",
"sourceUrl": "https://nodejs.org/download/release/v12.13.1/node-v12.13.1.tar.gz",
"libUrl": "https://nodejs.org/download/release/v12.13.1/win-x64/node.lib"
},
"osName": "Windows_NT",
"osRelease": "10.0.17134",
"osVersion": "Windows 10 Enterprise",
"osMachine": "x86_64",
"cpus": [
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 5664546,
"nice": 0,
"sys": 3876171,
"idle": 107558468,
"irq": 389625
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 5153359,
"nice": 0,
"sys": 2473421,
"idle": 109472218,
"irq": 44156
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 6340406,
"nice": 0,
"sys": 4032359,
"idle": 106726234,
"irq": 55343
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 5864171,
"nice": 0,
"sys": 2212093,
"idle": 109022734,
"irq": 32281
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 6080984,
"nice": 0,
"sys": 3754687,
"idle": 107263328,
"irq": 51015
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 5027500,
"nice": 0,
"sys": 1923109,
"idle": 110148390,
"irq": 37843
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 6650718,
"nice": 0,
"sys": 3162640,
"idle": 107285640,
"irq": 47531
},
{
"model": "Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz",
"speed": 3408,
"user": 5141875,
"nice": 0,
"sys": 1924468,
"idle": 110032656,
"irq": 30203
}
],
"networkInterfaces": [
{
"name": "Ethernet",
"internal": false,
"mac": "3c:52:82:66:86:8a",
"address": "fe80::e0b3:9450:6f17:1021",
"netmask": "ffff:ffff:ffff:ffff::",
"family": "IPv6",
"scopeid": 10
},
{
"name": "Ethernet",
"internal": false,
"mac": "3c:52:82:66:86:8a",
"address": "172.16.4.117",
"netmask": "255.255.248.0",
"family": "IPv4"
},
{
"name": "Loopback Pseudo-Interface 1",
"internal": true,
"mac": "00:00:00:00:00:00",
"address": "::1",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"family": "IPv6",
"scopeid": 0
},
{
"name": "Loopback Pseudo-Interface 1",
"internal": true,
"mac": "00:00:00:00:00:00",
"address": "127.0.0.1",
"netmask": "255.0.0.0",
"family": "IPv4"
}
],
"host": "RDTW01284"
},
"javascriptStack": {
"message": "No stack.",
"stack": [
"Unavailable."
]
},
"nativeStack": [
{
"pc": "0x00007ff788911729",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+10873"
},
{
"pc": "0x00007ff788915b4c",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+28316"
},
{
"pc": "0x00007ff788914b08",
"symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+24152"
},
{
"pc": "0x00007ff788a0369b",
"symbol": "v8::base::CPU::has_sse+37723"
},
{
"pc": "0x00007ff7892082de",
"symbol": "v8::Isolate::ReportExternalAllocationLimitReached+94"
},
{
"pc": "0x00007ff7891f0321",
"symbol": "v8::SharedArrayBuffer::Externalize+833"
},
{
"pc": "0x00007ff7890bdbec",
"symbol": "v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436"
},
{
"pc": "0x00007ff7890c8f90",
"symbol": "v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312"
},
{
"pc": "0x00007ff7890c5ac4",
"symbol": "v8::internal::Heap::PageFlagsAreConsistent+3204"
},
{
"pc": "0x00007ff7890bb353",
"symbol": "v8::internal::Heap::CollectGarbage+1283"
},
{
"pc": "0x00007ff7890b9b24",
"symbol": "v8::internal::Heap::AddRetainedMap+2356"
},
{
"pc": "0x00007ff7890dadf5",
"symbol": "v8::internal::Factory::NewFillerObject+53"
},
{
"pc": "0x00007ff788e46e19",
"symbol": "v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+4057"
},
{
"pc": "0x00007ff78963404d",
"symbol": "v8::internal::SetupIsolateDelegate::SetupHeap+567949"
},
{
"pc": "0x000001246cf93443",
"symbol": ""
}
],
"javascriptHeap": {
"totalMemory": 2150961152,
"totalCommittedMemory": 2150961152,
"usedMemory": 2129135824,
"availableMemory": 52074808,
"memoryLimit": 2197815296,
"heapSpaces": {
"read_only_space": {
"memorySize": 262144,
"committedMemory": 262144,
"capacity": 261872,
"used": 32296,
"available": 229576
},
"new_space": {
"memorySize": 2097152,
"committedMemory": 2097152,
"capacity": 1047488,
"used": 212944,
"available": 834544
},
"old_space": {
"memorySize": 2031726592,
"committedMemory": 2031726592,
"capacity": 2016133088,
"used": 2013024032,
"available": 3109056
},
"code_space": {
"memorySize": 1736704,
"committedMemory": 1736704,
"capacity": 1449632,
"used": 1449632,
"available": 0
},
"map_space": {
"memorySize": 1576960,
"committedMemory": 1576960,
"capacity": 1048640,
"used": 1048640,
"available": 0
},
"large_object_space": {
"memorySize": 113512448,
"committedMemory": 113512448,
"capacity": 113364728,
"used": 113364728,
"available": 0
},
"code_large_object_space": {
"memorySize": 49152,
"committedMemory": 49152,
"capacity": 3552,
"used": 3552,
"available": 0
},
"new_large_object_space": {
"memorySize": 0,
"committedMemory": 0,
"capacity": 1047488,
"used": 0,
"available": 1047488
}
}
},
"resourceUsage": {
"userCpuSeconds": 126.578,
"kernelCpuSeconds": 3.328,
"cpuConsumptionPercent": 216.51,
"maxRss": 2282307584,
"pageFaults": {
"IORequired": 1079275,
"IONotRequired": 0
},
"fsActivity": {
"reads": 2654,
"writes": 109
}
},
"libuv": [
],
"environmentVariables": {
REMOVED
},
"sharedObjects": [
"C:\\Program Files\\nodejs\\node.exe",
"C:\\WINDOWS\\SYSTEM32\\ntdll.dll",
"C:\\WINDOWS\\System32\\KERNEL32.DLL",
"C:\\WINDOWS\\System32\\KERNELBASE.dll",
"C:\\WINDOWS\\System32\\WS2_32.dll",
"C:\\WINDOWS\\System32\\RPCRT4.dll",
"C:\\WINDOWS\\SYSTEM32\\dbghelp.dll",
"C:\\WINDOWS\\System32\\ucrtbase.dll",
"C:\\WINDOWS\\System32\\ADVAPI32.dll",
"C:\\WINDOWS\\System32\\msvcrt.dll",
"C:\\WINDOWS\\System32\\sechost.dll",
"C:\\WINDOWS\\System32\\USER32.dll",
"C:\\WINDOWS\\System32\\win32u.dll",
"C:\\WINDOWS\\System32\\GDI32.dll",
"C:\\WINDOWS\\System32\\gdi32full.dll",
"C:\\WINDOWS\\System32\\msvcp_win.dll",
"C:\\WINDOWS\\System32\\PSAPI.DLL",
"C:\\WINDOWS\\System32\\CRYPT32.dll",
"C:\\WINDOWS\\System32\\MSASN1.dll",
"C:\\WINDOWS\\SYSTEM32\\IPHLPAPI.DLL",
"C:\\WINDOWS\\SYSTEM32\\USERENV.dll",
"C:\\WINDOWS\\SYSTEM32\\bcrypt.dll",
"C:\\WINDOWS\\System32\\profapi.dll",
"C:\\WINDOWS\\SYSTEM32\\WINMM.dll",
"C:\\WINDOWS\\SYSTEM32\\WINMMBASE.dll",
"C:\\WINDOWS\\System32\\cfgmgr32.dll",
"C:\\WINDOWS\\System32\\IMM32.DLL",
"C:\\WINDOWS\\System32\\powrprof.dll",
"C:\\WINDOWS\\SYSTEM32\\CRYPTBASE.DLL",
"C:\\WINDOWS\\System32\\bcryptPrimitives.dll",
"C:\\WINDOWS\\system32\\uxtheme.dll",
"C:\\WINDOWS\\System32\\combase.dll",
"C:\\WINDOWS\\system32\\mswsock.dll",
"C:\\WINDOWS\\System32\\kernel.appcore.dll",
"C:\\WINDOWS\\System32\\NSI.dll",
"C:\\WINDOWS\\SYSTEM32\\dhcpcsvc6.DLL",
"C:\\WINDOWS\\SYSTEM32\\dhcpcsvc.DLL",
"C:\\WINDOWS\\system32\\napinsp.dll",
"C:\\WINDOWS\\system32\\pnrpnsp.dll",
"C:\\WINDOWS\\system32\\NLAapi.dll",
"C:\\WINDOWS\\SYSTEM32\\DNSAPI.dll",
"C:\\WINDOWS\\System32\\winrnr.dll",
"C:\\WINDOWS\\System32\\wshbth.dll"
]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (4 by maintainers)
The recently released version of the CLI (8.3.22) has several improvements to prevent excessive memory usage when processing source maps. Based on the provided reproductions, the memory usage issues were no longer present when using the new version. For anyone experiencing memory issues, please update to the latest CLI version (currently
8.3.22
). Also ensure that the@angular-devkit/build-angular
version is at least0.803.22
. This package contains a majority of the build processing logic. It is also recommended to use the latest version of Node.js 12 as well (currently12.14.1
).If anyone is still encountering issues after ensuring these changes, please open a new issue describing the problem and if possible provide a minimal reproduction. In addition, please be aware that Node.js has a default memory limit of ~2GB and that for very large projects this may need to be increased. This can be accomplished via the following:
node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build
The 4096 value essentially represents a maximum memory usage value for the node process in megabytes. For this example, that would be 4GB of memory but can be adjusted as needed. Ensure that the system has enough physical memory to support the value chosen.An update to this; changing the
target
property intsconfig.json
fromes2015
toes5
results in a successful build.I have encountered the same issue now when trying to build for test env using anuglar 9 with ivy disabled
It is working again for me with the latest versions (released a few hours ago):
Changing the target to es5 disables differential loading, which may not be desired in all cases. https://angular.io/guide/deployment#differential-loading
FYI, changing to ES5 allowed my build to go through too
From #16520