AdmitHub / meteor-buildpack-horse

Heroku buildpack for Meteor v1.0+. The horse one.
MIT License
641 stars 586 forks source link

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory #179

Closed maxnowack closed 7 years ago

maxnowack commented 7 years ago
Type of problem
Summary

I've just upgraded to meteor v1.5.2. Now the build is failing

Contents of .meteor/release
METEOR@1.5.2
Buildpack version
https://github.com/AdmitHub/meteor-buildpack-horse.git
Logs
<--- Last few GCs --->
  296629 ms: Mark-sweep 1368.2 (1454.7) -> 1368.2 (1454.7) MB, 986.4 / 0 ms [allocation failure] [GC in old space requested].
  297706 ms: Mark-sweep 1368.2 (1454.7) -> 1368.2 (1454.7) MB, 1076.9 / 0 ms [allocation failure] [GC in old space requested].
  298749 ms: Mark-sweep 1368.2 (1454.7) -> 1364.9 (1454.7) MB, 1042.9 / 0 ms [last resort gc].
  299787 ms: Mark-sweep 1364.9 (1454.7) -> 1368.2 (1454.7) MB, 1038.1 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x33efb4037399 <JS Object>
    1: addMapping(aka SourceMapGenerator_addMapping) [/app/tmp/cache/meteor/.meteor/packages/meteor-tool/.1.5.2.15o6ss4++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/source-map/lib/source-map-generator.js:~94] [pc=0x156d19d75b98] (this=0x3eb619a78b91 <a SourceMapGenerator with map 0x31d045866ff9>,aArgs=0xf5b0c59eca9 <an Object with map 0x31d0458662e9>)
...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
/app/tmp/buildpacks/84221b9691f649157dfcb4cc24d9b5910f813f653ddc952a8f8e0a816e4a3d912ed985a25131084b5df37e720ae0e510ef4463cf515b7a5f3bacd7341f71f95f/bin/compile: line 107:   342 Aborted                 HOME="$METEOR_DIR" "$METEOR_DIR/.meteor/meteor" $ARGS
 !     Push rejected, failed to compile Node.js app.
 !     Push failed
Deployment target

heroku

maxnowack commented 7 years ago

Maybe it's related to the node 4.8.4 patch:

Node 4.8.4 has been patched to include https://github.com/nodejs/node/pull/14829, an important PR implemented by our own @abernix (:tada:), which fixes a faulty backport of garbage collection-related logic in V8 that was causing occasional segmentation faults during Meteor development and testing, ever since Node 4.6.2 (Meteor 1.4.2.3). When Node 4.8.5 is officially released with these changes, we will immediately publish a small follow-up release. Issue #8648

https://github.com/meteor/meteor/blob/devel/History.md#v152-2017-09-05

abernix commented 7 years ago

I suspect this problem is actually due to the fact that standard-minifier-js (a standard Meteor minififer configuration, uses uglify-js under the hood. However, uglify-js doesn't support all of the more modern ECMAScript language and fails. Meteor catches this failure and resorts to using babili (now called "Babel minify") however it is often excessive in memory usage and much slower.

The good news is that uglify-es is its successor and passes the test262 tests with much greater success, while still being quite fast. It is now the default in Meteor 1.6 (now in beta) thanks to https://github.com/meteor/meteor/pull/8698.

As a work around until Meteor 1.6 comes out, you can use abernix:standard-minifier-js, which uses uglify-es. Note that this is not an official recommendation, but I believe it will work for you.

maxnowack commented 7 years ago

I've removed standard-minifier-js and added your package abernix:standard-minifier-js, but the issue still persists :/

abernix commented 7 years ago

Can you fork https://github.com/abernix/minifier-js/ into your local packages directory (as instructed here) and then add debug logging on this line (and elsewhere, as appropriate) to see if it's Babel that is getting run?

maxnowack commented 7 years ago

@abernix how do I log correctly inside build plugins? I've added some console.log but nothing is getting logged. Here you'll find the file with the changes I've made: https://gist.github.com/maxnowack/db7c7d692ec09e87793554b85870c3c9

In an addition to that, the error occured also locally. So it seems, that it isn't an issue with the heroku buildpack but with meteor itself. So I've created meteor/meteor#9075