-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Maximum call stack size exceeded #728
Comments
@olback Operating System: macOS
ERROR in js/app.js from Terser I didn't encounter this error until I run npm clean cache / npm install when the terser-webpack-plugin updated to 2.3.7 from 2.3.6. My Webpack config
I also tried to give the parallel property a number value: 2 / os.cpus().length;() -1. let me know if I need to add/update something to overcome this problem. |
@nitinkumar8553 yours is a separate issue! @olback thanks for bringing this to my attention. I was able to narrow it down to a single, very long line which crashes babel's parser as well (I found that out while trying to prettify it). I'm going to narrow this down further and understand why. |
Ok, I narrowed it down to:
Plus 1600 times The reason this happens is because Terser's output system is based on (non-tail) recursion. It has to recurse every time it sees a .chain() and at some point it will be a stack overflow. I don't know how reasonable it is to expect Terser to fix this. I mean, there have to be reasonable limits to everything, and usually, the limits with Terser are whether something might be written by a human. In this case, I can't see someone sitting down and chaining method calls 1600 times. |
To expand on @nitinkumar8553's issue a little bit: You might've set the --max_old_space_size option on your toplevel node command, but as long as you have parallelism enabled, TerserPlugin will create a new node process to minify your code. When it does, you can't control what node flags are given to that new child process. |
@fabiosantoscode as I have already mentioned in my comment above. |
@nitinkumar8553 just to check, the flag is |
could anybody find a solution to this issue? |
@ezca2 if you can build your app outside of Docker but not with Docker, then please ensure that you are using the same node version in both environments. Additionally, remember to copy both the package-lock.json and package.json files into the Docker environment. |
after changing --max-old-space-size 4096 and also change terser version but the build is failed.could anybody find a solution to this issue? |
So, what you did for problem ? Is it not solved yet ?
…On Mon, 26 Jun 2023, 7:59 pm ezca2, ***@***.***> wrote:
@ezca2 <https://github.com/ezca2> you may have the same issue as #1402
<#1402>. Could you post any stack
trace you may have there?
Yes, i have read that post too at first time. Unfortunanly nobody could
find a solution yet.
My stack trace is exactly the same that published post's author.
Thanks
—
Reply to this email directly, view it on GitHub
<#728 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWZ6MAXCKJUMBYHPWEGVDZ3XNGMENANCNFSM4N3LQV4A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The stack trace from #1402 comes from a different tool than Terser. I don't have any information on what might have caused it (Terser version, input code, Terser options, does the issue go away without reduce_vars enabled, does the issue go away on another version), and couldn't obtain it so I closed it. I can guess a lot but I'm traveling right now and can't spend the time. I would appreciate if someone could open another issue with those details. |
I've published a version 5.18.2 that swaps a recursive function with a loop. The function wouldn't have been infinitely recursive, but seeing a huge number of function definitions might cause too much recursion. I don't know if this is the fix that needed to be pushed, but without any information, it's all I can do. |
For my case I followed this process . which is works for me.
This is the following process :
*- yarn cache clean --ignore-engines - yarn install
--ignore-engines - rm -r node_modules/terser
- npm install ***@***.*** --save-dev #- yarn run flow
- CI= yarn run build --verbose *
…On Tue, Jun 27, 2023 at 8:02 PM Fábio Santos ***@***.***> wrote:
I've published a version 5.18.2 that swaps a recursive function with a
loop. The function wouldn't have been infinitely recursive, but seeing a
huge number of function definitions might cause too much recursion.
—
Reply to this email directly, view it on GitHub
<#728 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWZ6MAWQMNMD26TU3M72CN3XNLVJPANCNFSM4N3LQV4A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Even though some other issues have crept into this discussion, this issue is related to code that has really deeply nested structures (expressions, statements, etc) and makes Terser crash as it uses recursion to transform it. As mentioned in #1477, this isn't really fixable for fundamental reasons. The workaround is to tell node.js to use a larger stack size.
Or, if you're using a script that uses Terser to minify:
edit: I closed this issue to prevent mixing it up with other recursion issues. If Terser is crashing with a recursion error and you think your code isn't extremely deeply nested, please open a new issue. |
Bug
Version (complete output of
terser -V
or specific git commit)Complete CLI command or
minify()
options usedterser
inputFrom olback/es6-css-minify#106:
https://github.com/olback/es6-css-minify/files/4762748/1.js.zip
terser
output or errorExpected result
Minified output
Related issues: #490, #543
The text was updated successfully, but these errors were encountered: