-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory #14628
Comments
We need a zip file or repo we can run, preferably without |
Sorry, but i can't send you source code. Maybe you can suggest in what direction i should investigate? |
This is something we'd have to investigate from our side. It's possible (but unlikely) there's some odd one-off pattern that's causing runaway allocation, in which case you may be able to reduce the problem to a representative repro. Otherwise we're kind of at a dead end here. Just for our information gathering purposes, how big (MB of .ts) is your project? |
Size: 9.5Mb It works when compile project without ts-loader, with tsc only. |
See also here: #14681 |
any idea about this? how can I help...? can't build with webpack anything with TS currently and the error is more than mystical. it crashes always, so annoying. |
having the same problem with "typescript": "~2.3.0-dev.20170301" |
@aight8 and @targunp can you share a repro project we can use to investigate? |
happens to me as well....i left the project untouched for a while.. it used to compile before |
I was able to fix it by having Strange, I did not need to do that before |
I have not reproduced it. But I think it happens if you have other package.json root's in one of a subfolder (maybe cause some conflicts with those packages etc.?). I have not specified include or files first because I was not so familiar how to configure tsconfig for the webpack loader - I thought you must not specify the files/include config because I don't want to use typescript as builder quasi - but as default it just scans every sub folder no matter how complex/nested project structure you have. I think this breaks the neck of our poor guy. However I think this shouldn't end in a fatal error. More informative information were better. |
@aight8 To me that's the difference maker. {
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es2016",
"noImplicitAny": false,
"sourceMap": true,
"strictNullChecks": true,
"importHelpers": true,
"allowJs": true,
"rootDir": "src",
"jsx": "react",
"lib": [
"dom",
"es2016"
]
},
// "include": [
// "src",
// "typedefs"
// ],
"exclude": [
"src/frontend"
]
} Commenting out the "include" portion yields
while having the "include" configuration compiles my project in a few seconds. |
by the way, this is not through webpack and ts-loader, this is my backend to be run by Node. |
[Summary for those who find this issue via Google.] Previous bugs like this have all been caused by trying to compile large Javascript libraries in While you're waiting for us to fix these bugs, here's how to find a workaround:
Finally, if you can share your project with us, it raises the probability we can fix the bug. A miniature repro is even better, of course, but that is difficult with crash bugs. |
@RyanCavanaugh try run this code in https://www.typescriptlang.org/play/
Browser will crash or you will get |
Thanks for the minified repro. For me, this example freezes the playground on Chrome, but I can't get it to crash
I also tried with 2.2.3 and the latest commit from master. None of them ran out of memory. I'll try to debug using the playground, but in the meantime can you confirm that you can repro the oo-memory crash with tsc from a clean directory? |
On my machine, if I paste in |
The playground is running 2.1.4-insiders.20161201. I tried with tsc 2.1.5 and and 2.1.7 and still couldn't repro. |
I'm sorry being misleading you. I used typescript@2.2.1 with webpack1 and ts-loader@2.0.1 add
add
|
@twoeo can you provide more detail? Check out the guide I wrote and if that doesn't solve your problem then open a bug for your crash. |
* Fix FATAL ERROR: ... JavaScript heap out of memory FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory microsoft/TypeScript#14628 * Fix out of date commander API
Got the same error on ts 2.2.2 or 2.3.1 / ts-loader or awesome-typescript-loader / UNIX or Win7. Error appears only while running tests on karma. About 50 tests pass, but about 60 crush. When I look at task manager, I see that node.exe takes about 1.9GB of ROM at this moment. Found some info that V8 JS engine allows only 1.7GB ROM for usage. May be there is a way to preprocess and/or process files not all at one moment and keep everything in memory, but 5 or 10 files? Here is my karma config
|
I came to the same isusse using typescript@2.5.0-dev.20170707 and gulp-typescript@3.2.0 |
If someone has the same propblem check how do you pass files to karma. |
@taoqf Can you provide more detail on your crash? Check out the guide I wrote and if that doesn't solve your problem then open a bug for your crash since the cause is almost certainly different from this one. |
OS: Debian
Exception i got: <--- Last few GCs --->
[24442:0x2def9d0] 58440 ms: Mark-sweep 1400.1 (1465.9) -> 1400.1 (1465.9) MB, 1948.3 / 0.0 ms allocation failure GC in old space requested
[24442:0x2def9d0] 60312 ms: Mark-sweep 1400.1 (1465.9) -> 1400.1 (1434.9) MB, 1871.6 / 0.0 ms last resort
[24442:0x2def9d0] 62184 ms: Mark-sweep 1400.1 (1434.9) -> 1400.0 (1434.9) MB, 1871.8 / 0.0 ms last resort
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x3d1f48829891 <JS Object>
2: write [/home/taoqf/feidao/temp/boai-h5-6/1/node_modules/typescript/lib/typescript.js:~9035] [pc=0x3cfdedb6fe70](this=0x1857e443e689 <an Object with map 0xddd4399bc9>,s=0x3c6749682c29 <String[4]: "id">)
3: pipelineEmitExpression [/home/taoqf/feidao/temp/boai-h5-6/1/node_modules/typescript/lib/typescript.js:~66807] [pc=0x3cfdedbd085f](this=0xf51a038dbf9 <JS Global Object>,node=0x29110b...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [gulp]
2: 0x13647ec [gulp]
3: v8::Utils::ReportOOMFailure(char const*, bool) [gulp]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [gulp]
5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [gulp]
6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [gulp]
7: 0x3cfded28437d
Aborted |
@sandersn Thanks, I have checked the guide list and could not solve my problem. |
@taoqf can you open a new issue? The cause is almost certainly different from this bug. |
I had this problem when I used: So I switched awesome-typescript-loader to ts-loader and then it worked. |
* Fix FATAL ERROR: ... JavaScript heap out of memory FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory microsoft/TypeScript#14628 * Fix out of date commander API
I had this issue and I fixed it by commenting out the line below...
|
add to the package.json -> scripts "webpack-dev-server": "node --max_old_space_size=4096 --optimize_for_size --stack_size=4096 ./node_modules/.bin/webpack-dev-server" |
Adding |
@sandersn Thank you for your detailed guide! |
@ekulabuhov I think automatic type acquisition only works for javascript projects. My advice is for Typescript projects. Is your project purely javascript? If so, consider opening a new issue because this one has been fixed for almost a year. |
@sandersn it's a mixed project. We've enabled allowJs: true recently. That caused the tsc to crash with out of memory exception. We had node_modules excluded already. So we specified which folders to include and it solved our problem. |
I have the same issue at my project. Isolated the prop that caused it - which was using webpack's EvalSourceMapDevToolPlugin (Also happens with SourceMapDevToolPlugin). |
i use the export NODE_OPTIONS=--max-old-space-size=4096 |
This is what I did (through the test option in the run command), but is that a real solution? It sounds like a patch to a larger issue. What if my tests and project keep on growing and that number won't be enough? |
no, its not a final solution. My team is also suffering from this issue and had to increase the max old space size several times now. This week we are upgrading to Webpack 4 and testing the performance. So far the results are very promising. |
Wow, gtk! I'll try to check it out and promote it in our team as well. |
TypeScript Version: 2.2.1
ts-loader version: 1.3.2 and 2.0.1 (probably no matter)
node version: v4.7.2 and v6.9.5 (probably no matter)
I use webpack + ts-loader with next config:
After upgrade typescript from 2.0.3 to 2.2.1 compilation fail with next error:
Expected behavior:
Compilation success
Actual behavior:
Compilation fail
The text was updated successfully, but these errors were encountered: