Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

grunt (really uglify) fails on sha512 #75

Closed
ktarplee opened this issue Apr 28, 2015 · 10 comments
Closed

grunt (really uglify) fails on sha512 #75

ktarplee opened this issue Apr 28, 2015 · 10 comments

Comments

@ktarplee
Copy link

grunt --with=sha512

Running "sources" task
Building modules: sha512

Running "uglify:release" (uglify) task
[RangeError: Maximum call stack size exceeded]

Uglifying source src/errors.js,src/utils.js,src/hash/hash.js,src/hash/sha512/sha512.asm.js,src/hash/sha512/sha512.js,src/hash/sha512/exports.js failed.
Warning: Uglification failed.
Maximum call stack size exceeded.
Use --force to continue.

Aborted due to warnings.

I tried increasing the stack trace but no luck. It keeps eating up memory an not completing.

node --stack-size=10000000 ./node_modules/.bin/grunt sha512
Warning: Task "sha512" not found. Use --force to continue.

Aborted due to warnings.
kmt-work:asmcrypto.js kmtarplee$ node --stack-size=10000000 ./node_modules/.bin/grunt --with=sha512
Running "sources" task
Building modules: sha512

Running "uglify:release" (uglify) task
^C

@ktarplee
Copy link
Author

I noticed you have your own uglify. I know infinite recursion was an issue in the upstream uglify so maybe that needs to be ported to yours?

@vibornoff
Copy link
Member

Unfortunately I can't reproduce this bug with my node v0.10.25.
Nonetheless I see my travis build failing with node v0.11.16 exactly due to this problem.

Just updated my uglify version with the upstram. Try it now.

Note, maybe you'll have to manually reinstall local uglify-js package with rm -rf node_modules/uglify-js && npm install

@ktarplee
Copy link
Author

I am using node v0.12.2 (via homebrew on the Mac).
Which branch do you want me to test? release or master

If I am on master and I change the package.json file:
"uglify-js": "=2.4.20",

rm -rf node_modules
npm install

grunt --with sha512

Running "sources" task
Building modules: sha512

Running "uglify:release" (uglify) task
[RangeError: Maximum call stack size exceeded]

Uglifying source src/errors.js,src/utils.js,src/hash/hash.js,src/hash/sha512/sha512.asm.js,src/hash/sha512/sha512.js,src/hash/sha512/exports.js failed.
Warning: Uglification failed.
Maximum call stack size exceeded.
Use --force to continue.

Aborted due to warnings.

@ktarplee
Copy link
Author

I updated uglify-js and grunt-contrib-uglify to the latest (also bumped grunt and grunt-cli but I don't think those matter). That seems to work.
"grunt --with sha512" now works.

Compression in uglify takes a long time (minutes for the above command). Disabling compression speeds it up grunt considerably. Is compression really necessary? The file is only 74KB with compression and 75KB without compression in the sha512 only case.

@ktarplee
Copy link
Author

Disabling compression with the old uglify works as well. You can leave compression enabled if you update the uglify and the grunt-contrib-uglify modules.

@vibornoff
Copy link
Member

About compression, @mishoo didn't approved the pull request #373 yet, so vanilla uglify-js breaks asm.js code (though it's still valid js code it doesn't pass asm.js verification and its performance dramatically degrades at least in Firefox). And that's why the compression takes so a long time.

You're right, when compression is turned off, vanilla uglify-js works fine. But it worth being turned on. With the latest patched uglify-js compressed asmcrypto.js results in 128KB vs 296KB uncompressed one.

That's why I have to maintain my own uglify-js untill @mishoo lets the patch in. You shouldn't change devDependencies in the package.json, uglify-js dependancy must be "vibornoff/UglifyJS2".

vibornoff added a commit that referenced this issue Apr 29, 2015
@vibornoff
Copy link
Member

@vibornoff
Copy link
Member

Trying another way with bab07e1

@vibornoff
Copy link
Member

@ktarplee
Copy link
Author

ktarplee commented May 1, 2015

I'm not sure why you closed this as your code does not work on the latest node (0.12.2).
"grunt --with sha512" is still failing unless you set mangle and compress to false in the Gruntfile

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants