Polymer / pwa-starter-kit

Starter templates for building full-featured Progressive Web Apps from web components.
https://pwa-starter-kit.polymer-project.org
2.36k stars 431 forks source link

allocation failure scavenge might not succeed #292

Closed scenaristeur closed 5 years ago

scenaristeur commented 5 years ago

Hi I love Polymer and was happy with Polymer2, now i want to migrate https://github.com/scenaristeur/heroku-spoggy to polymer3 !!! but with this new StarterKit, when running 'npm run build:static', i got this error

 ~/dev/spoggy4 $ npm run build:static

> spoggy@4.0.0 build:static /home/dfaveris/dev/spoggy4
> polymer build

info:   Clearing build/ directory...

<--- Last few GCs --->

[7282:0x3ad66a0]    76315 ms: Scavenge 1295.4 (1436.7) -> 1287.5 (1437.2) MB, 7.7 / 0.0 ms  (average mu = 0.197, current mu = 0.115) allocation failure 
[7282:0x3ad66a0]    76407 ms: Scavenge 1298.2 (1437.2) -> 1289.8 (1440.7) MB, 8.5 / 0.0 ms  (average mu = 0.197, current mu = 0.115) allocation failure 
[7282:0x3ad66a0]    79134 ms: Mark-sweep 1305.8 (1440.7) -> 1283.9 (1440.2) MB, 2699.7 / 0.0 ms  (average mu = 0.181, current mu = 0.165) allocation failure scavenge might not succeed

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x2e53d515be1d]
Security context: 0x1f9c15f9e6e1 <JSObject>
    1: call [0x331f287b7fe9] [/usr/lib/node_modules/polymer-cli/node_modules/babel-traverse/lib/path/context.js:~36] [pc=0x2e53d5b32d3b](this=0x1df8705b5db9 <NodePath map = 0x3d27cbf915b9>,key=0x1c570802c3c1 <String[5]: enter>)
    2: visit [0x331f287b80a9] [/usr/lib/node_modules/polymer-cli/node_modules/babel-traverse/lib/path/context.js:105] [bytecode=0x36...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8daaa0 node::Abort() [polymer]
 2: 0x8daaec  [polymer]
 3: 0xad79ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [polymer]
 4: 0xad7be4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [polymer]
 5: 0xece9e2  [polymer]
 6: 0xeceae8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [polymer]
 7: 0xedac12 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [polymer]
 8: 0xedb5d4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [polymer]
 9: 0xede241 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [polymer]
10: 0xea7564 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [polymer]
11: 0x114bc12 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [polymer]
12: 0x2e53d515be1d 
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! spoggy@4.0.0 build:static: `polymer build`
npm ERR! Exit status 134
npm ERR! 
npm ERR! Failed at the spoggy@4.0.0 build:static script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     [].npm/_logs/2018-12-11T08_17_03_831Z-debug.log

and in the debug.log :

 ~/dev/spoggy4 $ cat [].npm/_logs/2018-12-11T08_17_03_831Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'build:static' ]
2 info using npm@6.4.1
3 info using node@v10.12.0
4 verbose run-script [ 'prebuild:static', 'build:static', 'postbuild:static' ]
5 info lifecycle spoggy@4.0.0~prebuild:static: spoggy@4.0.0
6 info lifecycle spoggy@4.0.0~build:static: spoggy@4.0.0
7 verbose lifecycle spoggy@4.0.0~build:static: unsafe-perm in lifecycle true
8 verbose lifecycle spoggy@4.0.0~build:static: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/dfaveris/dev/spoggy4/node_modules/.bin:/home/dfaveris/bin:/home/dfaveris/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle spoggy@4.0.0~build:static: CWD: /home/dfaveris/dev/spoggy4
10 silly lifecycle spoggy@4.0.0~build:static: Args: [ '-c', 'polymer build' ]
11 silly lifecycle spoggy@4.0.0~build:static: Returned: code: 134  signal: null
12 info lifecycle spoggy@4.0.0~build:static: Failed to exec build:static script
13 verbose stack Error: spoggy@4.0.0 build:static: `polymer build`
13 verbose stack Exit status 134
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid spoggy@4.0.0
15 verbose cwd /home/dfaveris/dev/spoggy4
16 verbose Linux 4.15.0-42-generic
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "build:static"
18 verbose node v10.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 134
22 error spoggy@4.0.0 build:static: `polymer build`
22 error Exit status 134
23 error Failed at the spoggy@4.0.0 build:static script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 134, true ]

I 've tried with 'npm run build:static --unsafe-perm' but it's the same here is the repo concerned https://github.com/scenaristeur/spoggy4 . I'm not really aware with build / gulp / and what to put in the manifest.json, perharps am I missing something ? Any idea ? Thxs

keanulee commented 5 years ago

Does npm run build:prpl-server work? How about npx polymer build?

scenaristeur commented 5 years ago

npm run build:prpl-server -d -> same thing

~/dev/spoggy4 $ npm run build:prpl-server -d
npm info it worked if it ends with ok
npm info using npm@6.4.1
npm info using node@v10.12.0
npm info lifecycle spoggy@4.0.0~prebuild:prpl-server: spoggy@4.0.0
npm info lifecycle spoggy@4.0.0~build:prpl-server: spoggy@4.0.0

> spoggy@4.0.0 build:prpl-server []/dev/spoggy4
> polymer build --auto-base-path && gulp prpl-server

info:   Clearing build/ directory...

<--- Last few GCs --->

[3460:0x3455700]   113048 ms: Mark-sweep 1292.4 (1440.7) -> 1276.3 (1437.2) MB, 2488.8 / 0.0 ms  (average mu = 0.131, current mu = 0.062) allocation failure scavenge might not succeed
[3460:0x3455700]   113215 ms: Scavenge 1291.2 (1437.2) -> 1280.1 (1439.7) MB, 8.0 / 0.0 ms  (average mu = 0.131, current mu = 0.062) allocation failure 
[3460:0x3455700]   113247 ms: Scavenge 1295.8 (1439.7) -> 1283.3 (1441.7) MB, 6.9 / 0.0 ms  (average mu = 0.131, current mu = 0.062) allocation failure 

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1d5cd36dbe1d]
Security context: 0x1f1a9121e6e1 <JSObject>
    1: DoJoin(aka DoJoin) [0x1f1a91205e89] [native array.js:~87] [pc=0x1d5cd3fb6330](this=0x226ddd1026f1 <undefined>,l=0x02c2540576d9 <JSArray[8]>,m=8,A=0x226ddd1028c9 <true>,w=0x0490df42f131 <String[1]: />,v=0x226ddd1029a1 <false>)
    2: Join(aka Join) [0x1f1a91205ed9] [native array.js:~112] [pc=0x1d5cd3f88678](this=0x226ddd1026f1 <undefined>,l=0x02c254057...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8daaa0 node::Abort() [polymer]
 2: 0x8daaec  [polymer]
 3: 0xad79ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [polymer]
 4: 0xad7be4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [polymer]
 5: 0xece9e2  [polymer]
 6: 0xeceae8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [polymer]
 7: 0xedac12 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [polymer]
 8: 0xedb5d4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [polymer]
 9: 0xede241 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [polymer]
10: 0xea63c5  [polymer]
11: 0xeadd3b v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [polymer]
12: 0x11a5298 v8::internal::Runtime_StringBuilderJoin(int, v8::internal::Object**, v8::internal::Isolate*) [polymer]
13: 0x1d5cd36dbe1d 
Aborted (core dumped)
npm info lifecycle spoggy@4.0.0~build:prpl-server: Failed to exec build:prpl-server script
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! spoggy@4.0.0 build:prpl-server: `polymer build --auto-base-path && gulp prpl-server`
npm ERR! Exit status 134
npm ERR! 
npm ERR! Failed at the spoggy@4.0.0 build:prpl-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm timing npm Completed in 196109ms

npm ERR! A complete log of this run can be found in:

idem with npx

npx polymer build
info:   Clearing build/ directory...

<--- Last few GCs --->

[4461:0x449a6f0]    76806 ms: Mark-sweep 1302.1 (1440.2) -> 1284.5 (1439.2) MB, 2550.7 / 0.0 ms  (average mu = 0.151, current mu = 0.063) allocation failure scavenge might not succeed
[4461:0x449a6f0]    76983 ms: Scavenge 1299.4 (1439.2) -> 1287.7 (1439.7) MB, 8.5 / 0.0 ms  (average mu = 0.151, current mu = 0.063) allocation failure 
[4461:0x449a6f0]    77141 ms: Scavenge 1301.7 (1439.7) -> 1292.8 (1440.7) MB, 7.6 / 0.0 ms  (average mu = 0.151, current mu = 0.063) allocation failure 

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x133f8175be1d]
Security context: 0x33d1c7b1e6e1 <JSObject>
    1: step(aka step) [0x2aa17dd35489] [/usr/lib/node_modules/polymer-cli/node_modules/polymer-analyzer/lib/core/dependency-graph.js:~19] [pc=0x133f81f55532](this=0x1750382826f1 <undefined>,result=0x2aa17dd356d9 <Object map = 0x1f23a09061f1>)
    2: /* anonymous */ [0x2aa17dd2d619] [/usr/lib/node_modules/polymer-cli/node_modules/polymer-analyzer/lib/core/dep...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8daaa0 node::Abort() [polymer]
 2: 0x8daaec  [polymer]
 3: 0xad79ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [polymer]
 4: 0xad7be4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [polymer]
 5: 0xece9e2  [polymer]
 6: 0xeceae8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [polymer]
 7: 0xedac12 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [polymer]
 8: 0xedb5d4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [polymer]
 9: 0xede241 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [polymer]
10: 0xea7564 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [polymer]
11: 0x114bc12 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [polymer]
12: 0x133f8175be1d 
Abandon (core dumped)

could it be that i've not put my js import in polymer.json :

<script src="../node_modules/solid-file-client/solid-file-client.js"></script>
<script src="../node_modules/vis/dist/vis.min.js"></script>

or because i ask to load big librairies :

polymer serve
info:   Files in this directory are available under the following URLs
      applications: http://127.0.0.1:8081
      reusable components: http://127.0.0.1:8081/components/spoggy/

[BABEL] Note: The code generator has deoptimised the styling of undefined as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of undefined as it exceeds the max of 500KB.
frankiefu commented 5 years ago

Try increasing node memory limit --max_old_space_size and see if that helps. e.g.

$ export NODE_OPTIONS=--max_old_space_size=4096
$ npm run build:static
scenaristeur commented 5 years ago

hi @frankiefu , thanks, it looks that your command for increasing memory works

$ export NODE_OPTIONS=--max_old_space_size=4096
$ npm run build:static

but it tooks more that 20 mn to build !!

htop npm build2

scenaristeur commented 5 years ago

now i've to see if all my libs are in the build ! txs

frankiefu commented 5 years ago

@scenaristeur Glad it worked for you after increasing the memory limit. But taking 20 mins to run polymer build, that seems a lot. I saw there is a similar out of memory issue reported in polymer build tool. Feel free to add more comments to that issue if needed.

cc @usergenic