Next-translate: JavaScript heap out of memory when building

Created on 13 Feb 2020  路  7Comments  路  Source: vinissimus/next-translate

When trying to build my application with next-translate && next build it crashes after some time because the heap is out of memory.

I have 21 pages + _document, _app and _error and three languages.

It works fine when doing next translate && next

running only next-translate first and then next build doesn't help

Version: 0.7.0
Next.js: 9.2.1

Creating an optimized production build .
<--- Last few GCs --->

[32261:0x10288c000]   276781 ms: Scavenge 2027.2 (2050.3) -> 2026.7 (2050.5) MB, 5.5 / 0.0 ms  (average mu = 0.096, current mu = 0.000) allocation failure 
[32261:0x10288c000]   276789 ms: Scavenge 2027.5 (2050.5) -> 2026.9 (2050.8) MB, 5.0 / 0.0 ms  (average mu = 0.096, current mu = 0.000) allocation failure 
[32261:0x10288c000]   277977 ms: Mark-sweep 2027.7 (2050.8) -> 2025.9 (2050.8) MB, 1186.7 / 0.0 ms  (average mu = 0.089, current mu = 0.075) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1009311f9]
    1: StubFrame [pc: 0x1008b2d21]
Security context: 0x398272e408a1 <JSObject>
    2: SourceNode_add [0x3982c547e271] [/Users/bjoern/projects/inventhora/frontend/node_modules/source-map/lib/source-node.js:~172] [pc=0x34fb321bec7e](this=0x3982116b49a1 <SourceNode map = 0x398298c8a931>,0x3982116b4841 <SourceNode map = 0x398298c8a931>)
    3: /* anonymous */ [0x3982116b4a49] [/Users/bjoern/projects/inventho...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: report.20200213.163049.32261.0.001.json
Node.js report completed
 1: 0x10007f231 node::Abort() [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 2: 0x10007f3b5 node::OnFatalError(char const*, char const*) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 3: 0x100176887 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 4: 0x100176823 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 5: 0x1002fa9d5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 6: 0x1002fc0a4 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 7: 0x1002f8f77 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 8: 0x1002f6f5d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
 9: 0x100302674 v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
10: 0x1003026ef v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
11: 0x1002cf2e7 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
12: 0x1005f8935 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
13: 0x1009311f9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/bjoern/.nvm/versions/node/v12.14.1/bin/node]
/bin/sh: line 1: 32261 Abort trap: 6           next build
bug

All 7 comments

I tried in a project with same next version and next-translate version and it works well. The project that I tried is this one: https://github.com/aralroca/associacio_catalana_de_parkour

Can you provide me your next-translate config?

sure:

{
  "allLanguages": ["en", "pt", "es"],
  "defaultLanguage": "es",
  "currentPagesDir": "pages_",
  "finalPagesDir": "pages",
  "localesPath": "public/locales",
  "pages": {
    "*": ["common"],
    "/account/setpassword": ["forms"],
    "/": ["forms", "account"],
    "/inventory": ["table"],
    "/movements/[id]/edit": ["forms"],
    "/movements/import": ["forms"],
    "/movements": ["table"],
    "/movements/new": ["forms"],
    "/partners/[id]/edit": ["forms"],
    "/partners/import": ["forms"],
    "/partners": ["table"],
    "/partners/new": ["forms"],
    "/products/[id]/edit": ["forms"],
    "/products": ["table"],
    "/products/new": ["forms"],
    "/transportagencies/[id]/edit": ["forms"],
    "/transportagencies": ["table"],
    "/transportagencies/new": ["forms"],
    "/users/[id]/edit": ["forms"],
    "/users": ["table"],
    "/users/new": ["forms"],
    "/warehouses/[id]/edit": ["forms"],
    "/warehouses": ["table"],
    "/warehouses/new": ["forms"]
  }
}

Thanks. I am still unable to reproduce it. Does it work with old versions as 0.6.0? Do you think it is something of the new release?

no, I also tried it with 0.6.0, same result. It works fine when I deploy it to ZEIT Now though.

It's probably pretty hard for you to do anything about it, maybe it's also from the side of Next.js

I guess is related with this next issue https://github.com/zeit/next.js/issues/7929

@aralroca yea, probably. I will try it with the things suggested there tomorrow

I'm going to close the issue, so looks that is not an issue from this lib. Feel free to reopen if I'm wrong.

Was this page helpful?
0 / 5 - 0 ratings