ember-cli / ember-cli

The Ember.js command line utility.
https://cli.emberjs.com
MIT License
3.26k stars 1.16k forks source link

Production build errors #8118

Closed RobbieTheWagner closed 6 years ago

RobbieTheWagner commented 6 years ago

I am getting errors like this on 3.5.0-beta.2 and master branch when I run ember build -e production:

<--- Last few GCs --->

[16767:0x102801c00]    79950 ms: Mark-sweep 1384.2 (1424.9) -> 1383.9 (1425.4) MB, 1082.6 / 0.0 ms  (average mu = 0.104, current mu = 0.006) allocation failure scavenge might not succeed
[16767:0x102801c00]    80916 ms: Mark-sweep 1385.0 (1425.9) -> 1384.8 (1426.9) MB, 960.0 / 0.0 ms  (average mu = 0.059, current mu = 0.006) allocation failure scavenge might not succeed

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1a57cbadc01d]
Security context: 0x10f298d9e681 <JSObject>
    1: start [0x10f2197dd649] [/Users/rwwagner/shipshape/shipshape.io/node_modules/heimdalljs/dist/heimdalljs.cjs.js:~327] [pc=0x1a57cc3aaa14](this=0x10f2177858e1 <Heimdall map = 0x10f26969d271>,name=0x10f247075b81 <Object map = 0x10f23097a3e9>,Schema=0x10f25ed026f1 <undefined>)
    2: arguments adaptor frame: 1->2
    3: traverseTree(aka traverseTree) [0x10...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10003a08d node::Abort() [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 2: 0x10003a297 node::OnFatalError(char const*, char const*) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 3: 0x1001d2455 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 4: 0x10059d6d2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 5: 0x1005a01a5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 6: 0x10059c04f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 7: 0x10059a224 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 8: 0x1005a6aac v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
 9: 0x1005a6b2f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
10: 0x1005764b4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
11: 0x1007fe234 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/rwwagner/.nvm/versions/node/v10.11.0/bin/node]
12: 0x1a57cbadc01d
13: 0x1a57cc3aaa14
14: 0x1a57cba8a5a3

Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 3.5.0-beta.2
http_parser: 2.8.0
node: 10.11.0
v8: 6.8.275.32-node.28
uv: 1.23.0
zlib: 1.2.11
ares: 1.14.0
modules: 64
nghttp2: 1.33.0
napi: 3
openssl: 1.1.0i
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e
os: darwin x64
6.4.1
1.10.1
stefanpenner commented 6 years ago

@rwwagner90 interesting, looks like the issue may be coming from: https://github.com/broccolijs/broccoli/blob/631440d51c2315e9d348ff80bc4ce39a4ccf61df/lib/builder.js#L400

@rwwagner90 do you have a reproduction? That was help us understand exactly what is going sideways.

cc @oligriffiths this may be related to the heimdall compat stuff in https://github.com/broccolijs/broccoli/blob/631440d51c2315e9d348ff80bc4ce39a4ccf61df/lib/builder.js#L400, mind taking a look?

RobbieTheWagner commented 6 years ago

@stefanpenner yeah, if you pull https://github.com/shipshapecode/shipshape.io/tree/broken-production run yarn then do ember build -e production you can see the failures.

oligriffiths commented 6 years ago

@rwwagner90 Does commenting out https://github.com/broccolijs/broccoli/blob/631440d51c2315e9d348ff80bc4ce39a4ccf61df/lib/builder.js#L429-L430 fix the issue? Let's see if we can eliminate the cause.

RobbieTheWagner commented 6 years ago

@oligriffiths what has the dependency on this code? I'm happy to comment it out, but I'm not sure what has the direct broccoli dep, and where to yarn link it to test.

oligriffiths commented 6 years ago

ember-cli has the direct dependency on broccoli. You should be fine to comment it out and see if the issue persists.

RobbieTheWagner commented 6 years ago

@oligriffiths yes, commenting that out seems to fix things.

oligriffiths commented 6 years ago

Hmm, ok, i will do some digging

RobbieTheWagner commented 6 years ago

Feel free to ping me on discord or let me know of anything I can do to help.

oligriffiths commented 6 years ago

Digging into this further, it's entering an endless loop, will report more when I know more.

buschtoens commented 6 years ago

I'm having the same errors. But I also get them without the -e production flag.

@rwwagner90 Are you using an engine? I removed our engines from the package.json and now it works.

buschtoens commented 6 years ago

https://github.com/ember-cli/ember-cli/issues/8118#issuecomment-430240755

@rwwagner90 Does commenting out broccolijs/broccoli:lib/builder.js@631440d#L429-L430 fix the issue? Let's see if we can eliminate the cause.

@oligriffiths I can also confirm that uncommenting these two lines fixes the problem for us.

oligriffiths commented 6 years ago

Yeah I am investigating a recursive issue. It’s proving to be difficult. Will post updates as I find them

krisselden commented 6 years ago

https://github.com/broccolijs/broccoli/pull/379

oligriffiths commented 6 years ago

@krisselden thanks for that PR. I took the liberty to make it simpler whilst keeping the recursion as from what I can tell, the main crux of the issue was recursing for nodes that have already been processed.

https://github.com/broccolijs/broccoli/pull/380/

EDIT: closed that PR as whilst is fixes the problem in this issue, it doesn't fix the issue of graphs that exceed the stack. Your PR looks good @krisselden thanks for the work

scottkidder commented 6 years ago

Figured I should mention that I also just ran into this after trying to add ember-service-worker and friends. I got the error when running ember serve (not production build).

We do have an engine but removing it did not fix the issue.

RobbieTheWagner commented 6 years ago

Glad to see this is closed! Should things work now or do deps need to be updated to ones with the fix first in ember-cli?

buschtoens commented 6 years ago

@rwwagner90 Upgrade the transitive broccoli dependency to 2.0.1. Then it works. :)

I did this by forcing a yarn resolution for 2.0.1, then running yarn and then removing the resolution again. ember-cli work like a charm again. ❤️

pramodhk commented 4 years ago

Hi I am getting the same error in angular code while running the 'npm run pro'

RobbieTheWagner commented 4 years ago

@pramodhk this is Ember specific, so this likely won't help you with any Angular issues.