Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum call stack size exceeded #50195

Open
MiladSadinam opened this issue Aug 5, 2022 · 6 comments
Open

Maximum call stack size exceeded #50195

MiladSadinam opened this issue Aug 5, 2022 · 6 comments
Assignees
Labels
Bug A bug in TypeScript Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@MiladSadinam
Copy link

Bug Report

馃攷 Search Terms

Maximum call stack size exceeded,

馃晽 Version & Regression Information

I tried it on the following versions, all with the same error:

4.7.4
3.9.7
typescript@next

Please keep and fill in the line that best applies:

  • This is a crash

馃捇 Code

The error only occurs for the "whole" project. Compiling single files do not crash. Thus, I have removed some part of the project, still ensuring that the error still occurs. I hope it is ok that I upload part of our repo. I had a hard time reducing the problem to smaller code.

reproduction.zip

To reproduce it, go into the folder reproduction and execute tsc --project tsconfig.json.

馃檨 Actual behavior

The typescript compiler crashes with the error Maximum call stack size exceeded.

Some Background information:
We use a generator to generate typescript code. It produces multiple large files (~20K lines) and some heavily interconnected objects. This was ok until now. We changed the objects to use generic types, and from there the problem started.

I don't think the "structure" is the main problem, because some smaller generated files compile fine. It is just the largest of the files which is creating the problem. When I delete that one file, it compiles again.

馃檪 Expected behavior

Compiler shows a specific error instead of crashing.

@MartinJohns
Copy link
Contributor

You're advised to host the reproduction example on GitHub in a repository instead of uploading a sketchy zip file.

@MiladSadinam
Copy link
Author

You can now find the code also in https://github.com/MiladSadinam/Maximum-call-stack-size-exceeded

This is the problematic file (though the whole project is needed, so the crash occurs):
https://github.com/MiladSadinam/Maximum-call-stack-size-exceeded/blob/main/src/shared/api/scheduling-api/scheduling-api.service.ag.ts

@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.9.0 milestone Aug 5, 2022
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 5, 2022
@MiladSadinam
Copy link
Author

We would appreciate that - if possible - this issue get prioritized as it is blocking for us.

@axefrog
Copy link

axefrog commented Dec 21, 2022

Also experiencing this. It only happens for incremental compilation. The initial build always works. TypeScript version is 4.9.4. My project is big and complex and I'm having trouble figuring out what's causing the problem.

Stack trace:

[10:11:45 am] File change detected. Starting incremental compilation...

D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:99606
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at typeToTypeNodeWorker (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44213:42)
    at typeToTypeNodeHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44209:32)
    at mapToTypeNodes (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44969:40)
    at typeReferenceToTypeNode (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44747:49)
    at typeToTypeNodeWorker (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44361:95)
    at typeToTypeNodeHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44209:32)
    at serializeReturnTypeForSignature (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:45666:24)      
    at signatureToSignatureDeclarationHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:45050:42)
    at createTypeNodesFromResolvedType (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44811:43)      
    at createTypeNodeFromObjectType (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44665:35)

Node.js v17.4.0

@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Feb 1, 2023
@r3dDev
Copy link

r3dDev commented Aug 29, 2023

Also experiencing this. It only happens for incremental compilation. The initial build always works. TypeScript version is 4.9.4. My project is big and complex and I'm having trouble figuring out what's causing the problem.

Stack trace:

[10:11:45 am] File change detected. Starting incremental compilation...

D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:99606
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at typeToTypeNodeWorker (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44213:42)
    at typeToTypeNodeHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44209:32)
    at mapToTypeNodes (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44969:40)
    at typeReferenceToTypeNode (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44747:49)
    at typeToTypeNodeWorker (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44361:95)
    at typeToTypeNodeHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44209:32)
    at serializeReturnTypeForSignature (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:45666:24)      
    at signatureToSignatureDeclarationHelper (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:45050:42)
    at createTypeNodesFromResolvedType (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44811:43)      
    at createTypeNodeFromObjectType (D:\salix\modelling-tool\node_modules\typescript\lib\tsc.js:44665:35)

Node.js v17.4.0

hey man, I am facing the same problem, I only get this error when I update my code and save, but it's not happening when I am starting the server for 1st time

@alireza12prom
Copy link

Hello everyone,

I hope this message finds you well. I'm currently encountering an issue while attempting to build multiple TypeScript projects using Docker Compose. Each project has its own Dockerfile, and building them independently works without any problems. However, the problem comes in when I try to build them collectively using the docker-compose build command.

To provide more context:

  • I have three TypeScript projects, each with its own Dockerfile.
  • Building each project independently is successful.
  • The issue arises when using docker-compose build to build all projects together.

Error Message:

13.69 undefined:23
13.69 if(_err0) {
13.69 ^
13.69
13.69 RangeError: Maximum call stack size exceeded
13.69     at eval (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
13.69     at /node_modules/tsconfig-paths-webpack-plugin/lib/plugin.js:152:17
13.69     at /node_modules/enhanced-resolve/lib/Resolver.js:518:24
13.69     at eval (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:12:1)
13.69     at /node_modules/enhanced-resolve/lib/Resolver.js:518:24
13.69     at eval (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
13.69     at /node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:90:10
13.69     at /node_modules/enhanced-resolve/lib/Resolver.js:518:24
13.69     at eval (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
13.69     at /node_modules/tsconfig-paths-webpack-plugin/lib/plugin.js:152:17
13.69
13.69 Node.js v21.6.1
------
failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

7 participants