serverless: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Hello,
We’re trying to migrate to Serverless. Unfortunately, it looks like sls package -s dev just dies. We have a large project consisting of over 50 microservices. It seems that webpack is the issue when Googling, but no one really knows, nor does anyone have any good documentation on how to resolve this issue. If this has already been solved, please add a comment in the readme, so others can use this exciting tool.
<— Last few GCs —>
[22459:0x102654000] 70144 ms: Mark-sweep 1124.7 (1448.7) -> 1124.7 (1443.2) MB, 418.2 / 0.0 ms (average mu = 0.030, current mu = 0.000) allocation failure GC in old space requested [22459:0x102654000] 70664 ms: Mark-sweep 1132.0 (1449.3) -> 1131.0 (1442.8) MB, 493.3 / 0.0 ms (average mu = 0.040, current mu = 0.051) allocation failure GC in old space requested
<— JS stacktrace —>
==== JS stack trace =========================================
0: ExitFrame [pc: 0x187ce5a5be3d]
Security context: 0x0049a491e6e9 <JSObject> 1: byteLength(aka byteLength) [0x495a312c39] [buffer.js:531] [bytecode=0x49a3359161 offset=204](this=0x0049108826f1 <undefined>,string=0x0049f4851bc9 <Very long string[3131506]>,encoding=0x0049a493e991 <String[4]: utf8>) 2: arguments adaptor frame: 3->2 3: fromString(aka fromString) [0x495a320709] [buffer.js:342] [bytecode=0x49a3353141 offset=74]…
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x10003c597 node::Abort() [/usr/local/bin/node] 2: 0x10003c7a1 node::OnFatalError(char const*, char const*) [/usr/local/bin/node] 3: 0x1001ad575 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node] 4: 0x100579242 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node] 5: 0x10057bd15 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node] 6: 0x100577bbf v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node] 7: 0x100575d94 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 8: 0x10058262c v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node] 9: 0x1005826af v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node] 10: 0x100554534 v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node] 11: 0x100686109 v8::internal::String::SlowFlatten(v8::internal::Handlev8::internal::ConsString, v8::internal::PretenureFlag) [/usr/local/bin/node] 12: 0x1001cb30d v8::String::Utf8Length() const [/usr/local/bin/node] 13: 0x100050303 node::Buffer::(anonymous namespace)::ByteLengthUtf8(v8::FunctionCallbackInfov8::Value const&) [/usr/local/bin/node] 14: 0x10023663f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/usr/local/bin/node] 15: 0x100235b81 v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::FunctionTemplateInfo, v8::internal::Handlev8::internal::Object, v8::internal::BuiltinArguments) [/usr/local/bin/node] 16: 0x100235220 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node] 17: 0x187ce5a5be3d Abort trap: 6 serverless@1.49.0 │ ├─┬ @serverless/cli@1.0.1 │ │ ├─┬ @serverless/core@1.0.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 15 (4 by maintainers)
Commits related to this issue
- address OOM during sls deploy from github actions based on answer found in https://github.com/serverless/serverless/issues/6503#issuecomment-527674500 I have increased the max_old_space_size to let ... — committed to crunchie84/nl-tide-app by deleted user 4 years ago
- address OOM during sls deploy from github actions based on answer found in https://github.com/serverless/serverless/issues/6503#issuecomment-527674500 I have increased the max_old_space_size to let ... — committed to crunchie84/nl-tide-app by deleted user 4 years ago
Had similar issues with largish typescript projects and serverless-webpack-plugin.
Try
export NODE_OPTIONS=--max_old_space_size=8192In the command line in root of your project.
You’re right, it turns out I was mistakenly thinking it worked… but testing it again proved otherwise. 🤔