This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #6503
Comments
It's OOM error, which technically means that something tries to process too much within process memory. Do you have an idea what characteristics of your app may cause it (?) Have you tried to deploy the service without |
You might also want to look into https://github.com/FormidableLabs/serverless-jetpack |
Had similar issues with largish typescript projects and serverless-webpack-plugin. Try
|
@herebebogans That did the trick! |
@herebebogans I'm having a similar issue, which might be due to serverless-webpack-plugin. Where do you add |
In the command line in root of your project. |
Dundas,
You would probably want to add that to a shell script, if I’m understanding your question correctly.
#deploy.sh
export NODE_OPTIONS=--max_old_space_size=8192
sls deploy
Whatever shell process you are running in, setting these values before running serverless deploy; your node environment should pick that up. In our case, it seems webpack was causing this error, so I believe this should prevent this error. You could always play around with that value and see what works for you. We have quite a few microservices that get deployed in one template. If you’re using containers, then you would probably need to set your dockerfiles environment variables and rebuild, then rerun your deploy script, since node will be running in a separate process.
From: dundas <notifications@github.com>
Reply-To: serverless/serverless <reply@reply.github.com>
Date: Tuesday, September 3, 2019 at 5:09 PM
To: serverless/serverless <serverless@noreply.github.com>
Cc: Stu Murry <stu@stumurry.com>, Author <author@noreply.github.com>
Subject: Re: [serverless/serverless] FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory (#6503)
@herebebogans<https://github.com/herebebogans> I'm having a similar issue, which might be due to serverless-webpack-plugin. Where do you add export NODE_OPTIONS=--max_old_space_size=8192 to?
In the command line in root of your project.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#6503?email_source=notifications&email_token=ALF3MHWNNJWJYJ5WM3IPWUDQH3VCRA5CNFSM4IJMIHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5Z2ZBA#issuecomment-527674500>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALF3MHXVYFJOOVJL6VJOMZ3QH3VCRANCNFSM4IJMIHOA>.
|
@revgum : You referenced a comment as a solution to your issue but @rafa-as stated that this does not work if I understand well. I think it would be helpfull to the community if you mention this on that issue as well ;). Maybe the two of you could figure out what the differences are between your approaches |
You're right, it turns out I was mistakenly thinking it worked.. but testing it again proved otherwise. 🤔 |
In that case we can come to the same conclusion: however promising the npmrc solution sounds, like mentioned in nodejs/help#1783 (comment), It does not work yet. I tried some tests this morning and even though there is enough free memory, the process fails far before the memory usage reaches the 4gb I set it to in npmrc. |
Forgot to mention, for the sake of clarity, that running the script with those node options does work out well.
But as others mentioned already: that's not a pretty solution. Adding it in .npmrc would be prefereed. |
based on answer found in serverless/serverless#6503 (comment) I have increased the max_old_space_size to let serverless deploy with webpack hopefully succeed
based on answer found in serverless/serverless#6503 (comment) I have increased the max_old_space_size to let serverless deploy with webpack hopefully succeed
I have been working on a serverless project for a while, approximately 50 functions in typescript and was always building on a server. I have now moved to a machine with 16gb ram and running serverless webpack uses the entire system memory leading to a crash. I am not packing any external modules, just function code. It does seem there is a memory leak, the error appears to be coming from a service worker in the spawn process. Would a possible solution be to limit the number of concurrent subprocesses launched at once? |
Hey, still having this issue:
With this plugins & version:
Try with NODE_OPTIONS="--max_old_space_size=4096" but it crashs my computer (32Go RAM) so there is a memory leak somewhere. It keeps rise at each lambda execution & will crash after reaching the EDIT: seems it come from serverless-offline -> dherault/serverless-offline#1119 (comment) |
Also running into this while packaging up a fairly small one-function project. No plugins and no webpack, just some javascript code. Unsure how to investigate or resolve tbh. |
Moving it into discussions, as it's related to specific plugins usage, and it's not an issue in Framework core |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hello,
We're trying to migrate to Serverless. Unfortunately, it looks like
... Serverless: Including resource definition: cloudformation/health_check_failed.js Serverless: WARNING: Resource Mappings has multiple definitions. They will be merged.) Serverless: Including resource definition: cloudformation/params.js Serverless: Bundling with Webpack...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 =========================================
Security context: 0x0049a491e6e9
1: byteLength(aka byteLength) [0x495a312c39] [buffer.js:531] [bytecode=0x49a3359161 offset=204](this=0x0049108826f1 ,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(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
The text was updated successfully, but these errors were encountered: