Comments (4)
This might explain the issue I'm seeing. We're trying to compile assets for a Rails server with webpacker > uglifier. I believe we're using execjs to do so. This appears to be taking up so much memory that it crashes our CI system, even when giving it 32gb of memory:
ActionView::Template::Error:
<--- Last few GCs --->
[367:0x2642080] 53048 ms: Mark-sweep 1419.2 (1478.7) -> 1419.1 (1447.7) MB, 1132.9 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1133 ms) last resort GC in old space requested
[367:0x2642080] 53780 ms: Mark-sweep 1419.1 (1447.7) -> 1419.1 (1447.7) MB, 731.1 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x25bb8425879 <JSObject>
2: optimize [/tmp/execjs20190921-165-1yrzpkhjs:3798] [bytecode=0x3e88a7812099 offset=37](this=0x2bb5d4f0c2e1 <AST_Call map = 0x36f4f3cdbee1>,compressor=0x72f30c82c59 <Compressor map = 0x36f4f3cc62a9>)
3: before [/tmp/execjs20190921-165-1yrzpkhjs:3798] [bytecode=0x223f4c6266b1 offset=64](this=0x72f30c82c59 <Compressor map = 0x36f4f3cc62a9>,node=0x2bb5d4f0c2e1 <AST_Call map = 0x36f4f3cdbee1...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [nodejs]
2: 0x8cbf4c [nodejs]
3: v8::Utils::ReportOOMFailure(char const*, bool) [nodejs]
What's the workaround for this?
from uglifier.
This is all a special kind of nightmare.
Running an older version of uglifier (3.0.0) on our code was flat out crashing (we've seen this before but have no idea why, other than general crappiness of execjs)
rake aborted!
ExecJS::ProgramError: Unexpected token: operator (>) (line: 165515, col: 37, pos: 6800637)
Error
at new JS_Parse_Error (/tmp/execjs20190920-13904-1230of4js:3572:11870)
at js_error (/tmp/execjs20190920-13904-1230of4js:3572:12089)
at croak (/tmp/execjs20190920-13904-1230of4js:3572:20898)
at token_error (/tmp/execjs20190920-13904-1230of4js:3572:21035)
at unexpected (/tmp/execjs20190920-13904-1230of4js:3572:21123)
at expr_atom (/tmp/execjs20190920-13904-1230of4js:3572:29660)
at maybe_unary (/tmp/execjs20190920-13904-1230of4js:3573:143)
at expr_ops (/tmp/execjs20190920-13904-1230of4js:3573:901)
at maybe_conditional (/tmp/execjs20190920-13904-1230of4js:3573:993)
at maybe_assign (/tmp/execjs20190920-13904-1230of4js:3573:1436)
new JS_Parse_Error ((execjs):3572:11870)
So we bumped uglifier but then got this error:
Uglifier::Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
And enabling the harmony flag appears to consume all available memory and crash
from uglifier.
thanks @lautis !!
from uglifier.
Looks like this may still be an issue?
bundle show uglifier
/home/circleci/project/vendor/cache/ruby/2.5.0/gems/uglifier-4.2.0
But trying to run any rspec test that builds a bundle:
Failure/Error: = stylesheet_link_tag 'application'
ActionView::Template::Error:
<--- Last few GCs --->
[397:0x4172080] 58497 ms: Mark-sweep 1419.8 (1480.2) -> 1419.8 (1449.2) MB, 1126.9 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1127 ms) last resort GC in old space requested
[397:0x4172080] 59603 ms: Mark-sweep 1419.8 (1449.2) -> 1419.8 (1449.2) MB, 1106.2 / 0.0 ms last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x16200f125879 <JSObject>
2: /* anonymous */ [0x3b87c8b822d1 <undefined>:1] [bytecode=0x22658bbc7789 offset=0](this=0x393e3eb0c2f1 <JSGlobal Object>)
5: builtin exit frame: new Function(aka Function)(this=0x3b87c8b822d1 <undefined>,0x36791dfde7c1 <String[118]: switch(str){case "(":case "[":case "+":case "*":case "/":case "-":case ",":case ".":case "`":return true}return false;>,0x16200f1416e9 <String[3]: str>)
...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [nodejs]
2: 0x8cbf4c [nodejs]
3: v8::Utils::ReportOOMFailure(char const*, bool) [nodejs]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [nodejs]
5: v8::internal::Factory::NewCode(v8::internal::CodeDesc const&, unsigned int, v8::internal::Handle<v8::internal::Object>, bool, int) [nodejs]
6: v8::internal::CodeGenerator::MakeCodeEpilogue(v8::internal::TurboAssembler*, v8::internal::EhFrameWriter*, v8::internal::CompilationInfo*, v8::internal::Handle<v8::internal::Object>) [nodejs]
7: v8::internal::compiler::CodeGenerator::FinalizeCode() [nodejs]
8: v8::internal::compiler::PipelineImpl::FinalizeCode() [nodejs]
9: v8::internal::compiler::PipelineCompilationJob::FinalizeJobImpl() [nodejs]
10: v8::internal::Compiler::FinalizeCompilationJob(v8::internal::CompilationJob*) [nodejs]
11: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions() [nodejs]
12: v8::internal::StackGuard::HandleInterrupts() [nodejs]
13: v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*) [nodejs]
14: 0x51233a042fd
# (execjs):1
# ./vendor/cache/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:219:in `exec_runtime'
# ./vendor/cache/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
# ./vendor/cache/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
# ./vendor/cache/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
# ./vendor/cache/ruby/2.5.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
# ./vendor/cache/ruby/2.5.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
# ./vendor/cache/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/compressing.rb:65:in `block in js_compressor='
# ./vendor/cache/ruby/2.5.0/gems/sprockets-3.7.1/lib/sprockets/legacy_proc_processor.rb:31:in `call'
Entry point to above error is gems/uglifier-4.2.0/lib/uglifier.rb:221:in
run_uglifyjs'`
Config:
config.assets.js_compressor = Uglifier.new(harmony: true, mangle: false)
from uglifier.
Related Issues (20)
- inlining dependencies HOT 2
- Jekyll configuration to use ES6
- Different versions between `VERSION` and published HOT 2
- Uglifier::Error: Unexpected token: name (package)
- Uglifier::Error: HOT 6
- Uglifier Cannot Precompile JS Optional Chaining HOT 3
- Uglifier runs into problems with certain combination of modern JS syntax (await, destructuring, Promise.all) HOT 1
- Uglifier complains about field declaration syntax HOT 1
- NoMethodError: undefined method `start_with?' for nil:NilClass HOT 1
- jekyll 3.8.7 | Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
- Changing Uglifier.new parameters does nothing if I dont clean manually the assets files first HOT 2
- Documentation for :define => {} ?
- Custom replacements
- Uglifier::Error: - Solution: Switch to terser HOT 15
- Uglifier::Error: Unexpected token: punc (.) HOT 4
- Uglifier error in production mode on RoR 7.0.3.1 with Bootstrap 5.2 HOT 16
- Uglifier assets compiling error HOT 1
- XHTML style script tag within comment breaks parsing
- Update UglifyJS to 3.17.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uglifier.