-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Out of stack space error with tsc 3.0 #26721
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
Comments
Just to run through a checklist of things that are commonly a problem, do you have any long-chained expressions like Another thing to try is running with the |
I ran into this same error today. Tried upgrading from 2.8.1 to 3.0.1 and receive the same error:
Working on a Vue.js SPA project using AMD modules when the error hit. tsconfig.json like so:
After a bit of trial and error, found that deep nested components was the issue. Example: Have a component page “Systems”, which is a list of systems the user may edit. The edit button open a System modal (a child component) to view properties. One properties is a list of details of about the “System”, which is a child component. In the details, user may add/edit the detail by opening another model window and that too is a child component.
When I removed the 4th nested component, the TSC complied successfully. However, editing the output.js file, application/components works as expected. The limitation is within Typescript during build process. Know one option, is to combine the 4th component into the 3rd component. Could there be any other work-arounds?? |
We are having same problem. Tried switch from version 2.8 to 3.0.1:
|
Same problem with TS 3.1. |
We're also getting this error with 3.x. The error goes away if we remove a bunch of .ts files from a directory that has many of them. Everything compiles fine with version 2.8.3. |
I'm using TypeScript 2.7.2 (because of projects that won't allow me to move to 3), I've gone through a lot of due diligence and even restricted MSBuild to run as version 14 which alleviated it greatly but it is still happening and I have no idea what else to look for to troubleshoot this problem. I'm only getting this problem when I run it as part of a Azure DevOps Pipelines build. I can't seem to replicate it locally no matter how many times I run it. The suggestion of using 2.8.3 brings it up on my local machine immediately. |
We have a very large repository of TypeScript code which we recently upgraded from 2.7 to 3.0 (by updating TypeScriptToolsVersion element in all CSPROJs). After this change, we've been seeing occasional compiler crashes with the following stack trace:
>tsc -p tsconfig.json
Script failed with error: 'JsErrorScriptException (0x30001)'.
Out of stack space
Error: Out of stack space
at runWithCancellationToken (Unknown script code:83268:17)
at emit (Unknown script code:83160:13)
at emitFilesAndReportErrors (Unknown script code:86285:9)
at performCompilation (Unknown script code:88050:9)
at executeCommandLine (Unknown script code:88018:17)
at Global code (Unknown script code:88175:1)
>echo %errorlevel%
1
This doesn't occur every time and isn't specific to any project, TS file or the tsconfig file but some projects have a higher failure rate than others. I am unable to share the code being compiled but I don't think that would've been useful anyway because like I said, this isn't happening for anything specific. The best instructions to reproduce I can provide would be:
A. It crashes with that error about 90-95% of the times on exact same project.
B. Compiling that project by itself using the exact same (tsc -p) command line usually works.
C. It (the script) has been known to crash with that error for multiple projects on occasion.
Based on that, it seems to me that this isn't caused by a specific coding error. It just seems like during the various enhancements that were made during the 2.8, 2.9 or 3.0 releases, one or more code changes are responsible for consuming inappropriately large amount of stack space or something is going overly recursive.
If it were any other error, I think the callstack would've been much deeper but specifically because it was an "out of stack space" error, the callstack is trimmed at runWithCancellationToken function which has a catch block around a call to "func();". AFAICT, "func" is one of the "emitWorker" functions in tsc.js. The error could've originated several levels deep.
I'll be happy to collect more information (by say adding more try..catches in various functions in tsc.js to get a deeper callstack) when the crash occurs next time if someone can provide some guidance on what kind of information can help diagnose the root cause.
Thanks for your help. Please feel to ask any follow up questions you might have.
Search Terms and Related Issue: I searched for "Out of stack space" and found bug reports of compiler crashes but none of them looked like the same issue. #17112 is the closest thing I could find related to this.
The text was updated successfully, but these errors were encountered: