After programming some hours in dev env, node server crashs with this error :
<--- Last few GCs --->
[47073:0x104800000] 7043097 ms: Mark-sweep 1380.1 (1424.3) -> 1380.0 (1424.8) MB, 1170.5 / 0.0 ms (average mu = 0.159, current mu = 0.001) allocation failure scavenge might not succeed
[47073:0x104800000] 7044402 ms: Mark-sweep 1380.7 (1424.8) -> 1380.6 (1425.3) MB, 1301.5 / 0.0 ms (average mu = 0.080, current mu = 0.003) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0xa30765cfb7d]
Security context: 0x0da72a89d8c1 <JSObject>
1: parsePath(aka parsePath) [0xda7b3e73391] [/Users/pro/Documents/CLIENTS/node_modules/vue/dist/vue.runtime.common.dev.js:~497] [pc=0xa30788a252d](this=0x0da7414025b1 <undefined>,0x0da7391ee3c1 <String[10]: inputValue>)
2: initWatch(aka initWatch) [0xda7b3e75921] [/Users/pro/Documents/CLIENTS/node_mo...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x100061233 node::Abort() [/usr/local/bin/node]
2: 0x10006184d node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x100167953 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x1001678f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1004288e8 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/bin/node]
6: 0x10042a305 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
7: 0x100427c7d v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x100426a73 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10042e941 v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10042e990 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10040ed57 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
12: 0x1005ec896 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0xa30765cfb7d
14: 0xa30788a252d
Abort trap: 6
I'm not able give any reproduce repo due to the confidentiality of my project.
I'm using nuxt-apollo in this project, not sure if it can related with this memory leaks.
Having a server running correctly
Server crash several (≈ 2-6) times a day
Thanks for your help !
Thank you @clarkdo for your fix ! Unfortunately I still have memory leaks troubles 😕
My server crashed again today with this error:
<--- Last few GCs --->
[57880:0x104800000] 18415949 ms: Mark-sweep 1383.0 (1433.0) -> 1375.2 (1433.0) MB, 813.2 / 0.0 ms (average mu = 0.092, current mu = 0.012) allocation failure scavenge might not succeed
[57880:0x104800000] 18416785 ms: Mark-sweep 1383.1 (1433.0) -> 1376.8 (1433.0) MB, 822.2 / 0.0 ms (average mu = 0.055, current mu = 0.016) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x12435151d8c1 <JSObject>
0: builtin exit frame: clear(this=0x12438d37fe39 <Set map = 0x124357783d81>,0x12438d37fe39 <Set map = 0x124357783d81>)
1: initWatch(aka initWatch) [0x1243e28ad601] [/Users/pro/Documents/CLIENTS/Hubworkair/hubworkair.com/node_modules/vue/dist/vue.runtime.common.dev.js:~4857] [pc=0x30ee0619073c](this=0x1243f59025b1 <undefined>,0x1243dd6d6589 <VueComponent map = 0x1243853105d1>,0x1243df379...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x100061233 node::Abort() [/usr/local/bin/node]
2: 0x10006184d node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x100167953 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x1001678f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1004288e8 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/bin/node]
6: 0x10042a305 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
7: 0x100427c7d v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x100426a73 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10042e941 v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10042e990 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10040e733 v8::internal::Factory::AllocateRawArray(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
12: 0x10040e5e9 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [/usr/local/bin/node]
13: 0x100539f89 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Allocate(v8::internal::Isolate*, int, v8::internal::PretenureFlag) [/usr/local/bin/node]
14: 0x10053a37c v8::internal::OrderedHashTable<v8::internal::OrderedHashSet, 1>::Clear(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashSet>) [/usr/local/bin/node]
15: 0x1005189ea v8::internal::JSSet::Clear(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSSet>) [/usr/local/bin/node]
16: 0x1001d61b0 v8::internal::Builtin_Impl_SetPrototypeClear(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
17: 0x30ee023cfcdd
18: 0x30ee0619073c
19: 0x30ee0238e458
Abort trap: 6
Thanks for help
@luxkyluke Have you tried nuxt-edge ?
The fix hasn’t been released yet
Ha ok ! I'll try then !
Thanks
@clarkdo I'm now on Nuxt 2.6.1 and I still have memory leaks 😕
Today, it happened a couple of time with this error:
<--- Last few GCs --->
[35454:0x104800000] 3763735 ms: Mark-sweep 1381.6 (1425.6) -> 1381.5 (1426.6) MB, 1147.4 / 0.0 ms (average mu = 0.063, current mu = 0.001) allocation failure scavenge might not succeed
[35454:0x104800000] 3764482 ms: Mark-sweep 1382.2 (1426.6) -> 1382.1 (1426.6) MB, 744.6 / 0.0 ms (average mu = 0.039, current mu = 0.003) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x104b4da4fb7d]
Security context: 0x0041f2a9d8c1 <JSObject>
1: new Set(aka Set) [0x41f2a90331](this=0x00411e702691 <the_hole>)
2: ConstructFrame [pc: 0x104b4da09e66]
3: initWatch(aka initWatch) [0x41c0935691] [/Users/pro/Documents/CLIENTS/node_modules/vue/dist/vue.runtime.common.dev.js:~4857] [pc=0x104b50408d31](this=0x00411e7025b1 <undefined>,0x0041b38fc9e1 <VueComponent map = 0...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x100061233 node::Abort() [/usr/local/bin/node]
2: 0x10006184d node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x100167953 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x1001678f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1004288e8 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/bin/node]
6: 0x10042a305 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
7: 0x100427c7d v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x100426a73 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x10042e941 v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10042e990 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10040ed57 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
12: 0x1005ec896 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x104b4da4fb7d
Abort trap: 6
Thanks again for you help
@luxkyluke
Sorry about that I didn't comment in this issue in time.
Could you please check my comment in https://github.com/nuxt/nuxt.js/pull/5452 ?
Since the original fix may lead to problem in repos which include modules are using Node.js env
, so we decide to make the fix optional by using build.standalone
and adding libs which are using Node.js env
like firebase
to externals
.
+1
Having the same problem for a few month's already. My project is very large, with like 100+ components. The build time in nuxt 2+ at least for me is poor then 1+. My node consuming is 1.3gb.
Does anyone know how to optimize the build time?
PS: --max-old-space-size=4076 does not work
@kavalcante For memory issue in dev mode, could you please have a look at and try the solution in my comment above ?
About the build time part, maybe you can try build.hardSource and build.parallel. But it would be better that you can provide us more details about you project, like profile report
@clarkdo I solved adding this line to my script: --max_old_space_size=8192 --optimize_for_size
Probably is not the best option, but I don't have much time to check this issue right now. I have another question, when I do any chance on my code, the hot-reload also take so much long to recompile. Does your comment above, help with this question too?
<--- Last few GCs --->
[17668:0x3d5b2e0] 172779 ms: Mark-sweep 1956.0 (1983.9) -> 1954.5 (1983.7) MB, 2959.6 / 0.0 ms (average mu = 0.064, current mu = 0.006) allocation failure scavenge might not succeed
[17668:0x3d5b2e0] 175704 ms: Mark-sweep 1955.3 (1983.7) -> 1955.0 (1983.2) MB, 2916.4 / 0.0 ms (average mu = 0.034, current mu = 0.004) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x134e879]
1: StubFrame [pc: 0x12c907b]
2: StubFrame [pc: 0x13aef7d]
Security context: 0x0bc80fd80919
3: /* anonymous /(aka / anonymous */) [0x1a76d47f7331] [/var/www/iyb-frontend/node_modules/vue/dist/vue.runtime.common.prod.js:6] bytecode=0x4d756281ef1 offset=42
4: new un [0x1b2d41818701] [/var/www/iyb-frontend/node_m...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Writing Node.js report to file: report.20190926.170859.17668.0.001.json
Node.js report completed
1: 0x9bcb80 node::Abort() [node]
2: 0x9bdd16 node::OnFatalError(char const, char const) [node]
3: 0xb1948e v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [node]
4: 0xb19809 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [node]
5: 0xcca1f5 [node]
6: 0xcca866 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xcd609a v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xcd6fa5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xcd9a68 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
10: 0xca1597 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType) [node]
11: 0xfc9708 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate) [node]
12: 0x134e879 [node]
Aborted
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] start: nuxt start --max_old_space_size=3072 --optimize_for_size
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dilik/.npm/_logs/2019-09-26T12_08_59_296Z-debug.log
Still got this problem... Looks something plays in infinite loop but I don't know what it is.
meet the same problem
@clarkdo Have the problem solved? In production env too
As memory leak issue may have many different root causes and there is no common leak issue reported now, so we can only look into your issue as a special case in specific scenario, can you please provide a reproducible repo?
Same problem here.
Same problem here.
+1
Same here. Crashed suddenly after a day of running in development mode.
Fresh install here, runs for like 10 minutes and the crashes over and over again with the same memory issue.
Hi all,
Same problem here. Try this nuxt --max_old_space_size=8000
It worked for me.
Hi all,
Same problem here. Try this
nuxt --max_old_space_size=8000
It worked for me.
Thanks for the possible solution. For me, it lasts a little longer, but crashes nevertheless.
We started seeing this error when we upgraded Nuxt from 2.10 to 2.12.2. I tried to find a solution for a few hours but later gave up and revert the project to 2.10. We use SPA mode and have a big project with more than 100 components.
P.S: nuxt build --max_old_space_size=8192
didn't help as well.
We are also impacted by this, we have very few components but a large number of pages being built, reliably crashes every build when using the full dataset.
Same problem
same here, it happened several times with no obvious reason.
Same, fails at least 4 times a day, wouldn't be a big deal if the nuxt would start up fast but it takes around 3 minutes each time.
For everyone who faces this problem. Try to bump memory limit with max-old-space-size
node optimization flag, but use it correctly. As example:
"scripts": {
"dev": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js",
"build": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js build",
"start": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js start"
}
And example for TS guys:
"scripts": {
"dev": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js",
"build": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js build",
"start": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js start"
}
If you still get errors, allocate some more memory --max-old-space-size=8192
etc.
If you don't have enough memory on the node, try to add flag --optimize_for_size
, this will allow less memory to be allocated, but may affect performance and give some errors in theory.
An alternative to modifying the script commands:
NODE_OPTIONS=--max_old_space_size=4096 npm run build
In my case this was only a build issue that i needed to do on a one off
Most helpful comment
+1