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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@next runs out of memory on build, throws JS stacktracke #4902

Closed
hyperknot opened this issue Aug 20, 2018 · 8 comments
Closed

@next runs out of memory on build, throws JS stacktracke #4902

hyperknot opened this issue Aug 20, 2018 · 8 comments
Labels

Comments

@hyperknot
Copy link

I'm getting this one with @next branch. I'm using:

npx create-react-app@next --scripts-version=2.0.0-next.3e165448 app-name
<--- Last few GCs --->

[74687:0x103000000]    80393 ms: Mark-sweep 1364.8 (1460.4) -> 1364.6 (1463.4) MB, 1038.8 / 0.0 ms  allocation failure GC in old space requested
[74687:0x103000000]    81325 ms: Mark-sweep 1364.6 (1463.4) -> 1364.4 (1429.9) MB, 931.1 / 0.0 ms  last resort GC in old space requested
[74687:0x103000000]    82266 ms: Mark-sweep 1364.4 (1429.9) -> 1364.4 (1426.9) MB, 940.7 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x13240d025879 <JSObject>
    1: _parseMappings(aka SourceMapConsumer_parseMappings) [/Users/user/nonsync/dev/populus/groundtruth/fe/build/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:~468] [pc=0x1a0d2022cd16](this=0x13244ecf6989 <BasicSourceMapConsumer map = 0x13240e45fe21>,aStr=0x13245a582201 <Very long string[6486484]>,aSourceRoot=0x13244ecf6ce1 <String[50]: /Users/user/nonsync/dev/p...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/user/n/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/user/n/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/user/n/bin/node]
 4: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [/Users/user/n/bin/node]
 5: v8::internal::HashTable<v8::internal::NameDictionary, v8::internal::NameDictionaryShape>::EnsureCapacity(v8::internal::Handle<v8::internal::NameDictionary>, int, v8::internal::PretenureFlag) [/Users/user/n/bin/node]
 6: v8::internal::Dictionary<v8::internal::NameDictionary, v8::internal::NameDictionaryShape>::Add(v8::internal::Handle<v8::internal::NameDictionary>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDetails, int*) [/Users/user/n/bin/node]
 7: v8::internal::LookupIterator::ApplyTransitionToDataProperty(v8::internal::Handle<v8::internal::JSObject>) [/Users/user/n/bin/node]
 8: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/Users/user/n/bin/node]
 9: v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/user/n/bin/node]
10: 0x1a0d1fa842fd
11: 0x1a0d2022cd16
12: 0x1a0d1fcf6ee2
error Command failed with signal "SIGABRT".
@hyperknot hyperknot changed the title @next runs out of memory, throws JS stacktracke @next runs out of memory on build, throws JS stacktracke Aug 20, 2018
@hyperknot
Copy link
Author

It goes up to 1.36 GB of memory usage before terminating.

@hyperknot
Copy link
Author

hyperknot commented Aug 20, 2018

I've run into critical issues with next.

  • Bundle size is 2x compared to 1.x.
  • Runs into 1.4 GB memory issue and then terminates
  • If I disable source map and minification so that it finally builds, the build takes 144 sec vs. 36 sec for 1.x

=> I'd consider @next branch to be unusable as of today and I've reverted everything to 1.x.

@hyperknot
Copy link
Author

hyperknot commented Aug 20, 2018

I think it might be because of UglifyJsPlugin / uglifyjs-webpack-plugin.

I can replicate it on 1.x by using UglifyJsPlugin + options from 2.x, even with a mangle-only config:

new UglifyJsPlugin({
      uglifyOptions: {
        parse: {
          // we want uglify-js to parse ecma 8 code. However, we don't want it
          // to apply any minfication steps that turns valid ecma 5 code
          // into invalid ecma 5 code. This is why the 'compress' and 'output'
          // sections only apply transformations that are ecma 5 safe
          // https://github.com/facebook/create-react-app/pull/4234
          ecma: 8,
        },
        compress: false,
        mangle: {
          safari10: true,
        },
        output: {
          ecma: 5,
          comments: false,
          // Turned on because emoji and regex is not minified properly using default
          // https://github.com/facebook/create-react-app/issues/2488
          ascii_only: true,
        },
      },
      // Use multi-process parallel running to improve the build speed
      // Default number of concurrent runs: os.cpus().length - 1
      parallel: true,
      // Enable file caching
      cache: true,
      sourceMap: shouldUseSourceMap,
    }),

@SPAHI4
Copy link

SPAHI4 commented Aug 24, 2018

I can't specify the version, but since one of the last npm @next releases, it does the same for me.

after overriding UglifyJsPlugin options with sourceMap: false it works

@bugzpodder
Copy link

There is a GENERATE_SOURCEMAP option on the CI env variable that you can disable when building:
https://github.com/facebook/create-react-app/blob/69c3d4b04c233ba9fb9d16691056bd09076177b1/packages/react-scripts/template/README.md#advanced-configuration

@hyperknot
Copy link
Author

The issue is that @next is using significantly more memory and is much slower compared to 1.x, even with identical Uglifyjs plugin.

@Timer
Copy link
Contributor

Timer commented Sep 18, 2018

@hyperknot can you please subscribe to #5024 and test the next v2 beta when it comes out? It should be soon.

@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 2, 2018
@Timer Timer closed this as completed Nov 2, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants