sourcegraph/browser-extensions

yarn run dev sometimes OOMs

chrismwendt opened this issue · 4 comments

Jotting this down for future reference, or if anyone else knows how to avoid this. Here's the dump:

Error: Could not import `../node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css` from any of the following locations:
  /Users/chrismwendt/sourcegraph/browser-extensions/node_modules/@sourcegraph/codeintellify/node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css
  /Users/chrismwendt/sourcegraph/node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css
  /node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css
  /Users/chrismwendt/sourcegraph/browser-extensions/src/node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css

<--- Last few GCs --->

[13990:0x102802a00]  5724012 ms: Mark-sweep 1348.5 (1409.0) -> 1348.5 (1408.5) MB, 804.3 / 0.0 ms  (average mu = 0.089, current mu = 0.000) last resort GC in old space requested
[13990:0x102802a00]  5724897 ms: Mark-sweep 1348.5 (1408.5) -> 1348.5 (1408.5) MB, 885.7 / 0.0 ms  (average mu = 0.045, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x39499235c01d]
Security context: 0x0d8675f1e549 <JSObject>
    1: byteLength(aka byteLength) [0xd8635e9aad1] [buffer.js:532] [bytecode=0xd8626f3a891 offset=204](this=0x0d868ff026f1 <undefined>,string=0x0d86cc582a19 <Very long string[11331851]>,encoding=0x0d8675f3c5e9 <String[4]: utf8>)
    2: arguments adaptor frame: 3->2
    3: fromString(aka fromString) [0xd8635eaaea1] [buffer.js:343] [bytecode=0xd8626f3a2c1 offse...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x100038c65 node::Abort() [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 2: 0x100038e41 node::OnFatalError(char const*, char const*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 3: 0x1001b43a5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 4: 0x10057ee02 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 5: 0x1005882e4 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 6: 0x10055a0f4 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 7: 0x10068bb79 v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 8: 0x1001d208d v8::String::Utf8Length() const [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 9: 0x10004bf3b node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
10: 0x10023c58f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
11: 0x10023bad1 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/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
12: 0x10023b170 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
13: 0x39499235c01d
error Command failed with signal "SIGABRT".

O.o hmmmm. Haven't seen that before! Thanks for making the note in case anyone else sees this.

Encountered another OOM:


<--- Last few GCs --->

[28378:0x104000600]  1023266 ms: Mark-sweep 1371.3 (1437.0) -> 1368.1 (1437.5) MB, 1062.4 / 0.0 ms  (average mu = 0.156, current mu = 0.105) allocation failure scavenge might not succeed
[28378:0x104000600]  1024351 ms: Mark-sweep 1371.6 (1437.5) -> 1368.3 (1456.0) MB, 1061.5 / 0.0 ms  (average mu = 0.091, current mu = 0.022) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0xa65c215c01d]
Security context: 0x0efbdcc9e549 <JSObject>
    1: parseTypeWorker(aka parseTypeWorker) [0xefbd6521871] [/Users/chrismwendt/sourcegraph/browser-extensions/node_modules/typescript/lib/typescript.js:~17920] [pc=0xa65c47e53b0](this=0x0efb4da826f1 <undefined>,noConditionalTypes=0x0efb4da826f1 <undefined>)
    2: arguments adaptor frame: 0->1
    3: doOutsideOfContext(aka doOutsideOfContext) [0xefbd651d2c1]...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100038c65 node::Abort() [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 2: 0x100038e41 node::OnFatalError(char const*, char const*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 3: 0x1001b43a5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 4: 0x10057ee02 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 5: 0x1005818d5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 6: 0x10057d77f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 7: 0x10057b954 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 8: 0x1005881cc v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
 9: 0x10058824f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
10: 0x100557be4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
11: 0x1007dfc84 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/chrismwendt/Downloads/node-v9.11.2-darwin-x64/bin/node]
12: 0xa65c215c01d
error Command failed with signal "SIGABRT"

Let's just set NODE_OPTIONS=--max_old_space_size=4096 in the npm scripts, we do that in the webapp too. The default is quite low and compilation can take some memory.

👍 NODE_OPTIONS=--max_old_space_size=4096 was added to the npm scripts.