Shopify / slate

Slate is a toolkit for developing Shopify themes. It's designed to assist your workflow and speed up the process of developing, testing, and deploying themes.
https://shopify.github.io/slate
MIT License
1.28k stars 364 forks source link

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #949

Open ghost opened 5 years ago

ghost commented 5 years ago

Problem

When making a change whilst using slate start or slate watch I get the following error:

⠹  Compiling...
<--- Last few GCs --->

[5417:0x103801600]   349693 ms: Mark-sweep 1358.5 (1388.2) -> 1358.3 (1388.2) MB, 219.1 / 0.0 ms  (average mu = 0.925, current mu = 0.000) last resort GC in old space requested
[5417:0x103801600]   349913 ms: Mark-sweep 1358.3 (1388.2) -> 1358.3 (1388.2) MB, 220.2 / 0.0 ms  (average mu = 0.858, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x3dcbd6f841bd]
Security context: 0xdde809e6c9 <JSObject>
    1: byteLength(aka byteLength) [0xdd782ff751] [buffer.js:530] [bytecode=0xddc3f216a9 offset=204](this=0xddc98822e1 <undefined>,string=0xdd7123d5f1 <Very long string[14154049]>,encoding=0xdde80b26c1 <String[4]: utf8>)
    2: arguments adaptor frame: 3->2
    3: fromString(aka fromString) [0xdd89317be9] [buffer.js:341] [bytecode=0xddc3f1b971 offset=74](this=0...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x1000389cc node::Abort() [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 2: 0x100038ba8 node::FatalTryCatch::~FatalTryCatch() [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 3: 0x1001a9d5a v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 4: 0x100578772 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 5: 0x1005819cf v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 6: 0x100552bb0 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 7: 0x10067a8c6 v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 8: 0x1001c80a0 v8::String::Utf8Length() const [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
 9: 0x10004b811 node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
10: 0x10023688f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
11: 0x100235dd1 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
12: 0x100235420 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node]
13: 0x3dcbd6f841bd
/var/folders/pv/8qhjxydn7wx9p9wlv8vtsjd40000gn/T/yarn--1547612787468-0.37985182968691666/node: line 3:  5417 Abort trap: 6           "/Users/dotdev/.nvm/versions/node/v10.7.0/bin/node" "$@"
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Not sure but it might be relevant that the particular theme I am working on has several product templates each with different JS and several collection templates each with different JS.

t-kelly commented 5 years ago

This is a project specific error in Node's v8 engine. You will need to provide us with a way to reliably reproduce this if you want others the help debug it and find a fix.

ghost commented 5 years ago

@t-kelly Okay will do. It may take a while to do so, as a quick fix is there somewhere in slate I can start node with a bigger heap size using this: node --max-old-space-size=4096. Have you got any recommendations on where to start finding the route of this issue? Have never experienced an error like this before.