find and fix memory leak
Describe the bug When running the app for some time the memory increases and then the app crashes. This seamse to be related to Server Side Rendering where librarys or listeners are registered that are not cleaned up or not intended for use on the server.
In the nuxt.js issue thread below there is a hint to not use the created() hook but the beforeMounted() hook where possible (plus removing listeners etc.) to prevent behavior on the server and alternativly also set plugins to ssr: false where possible
https://github.com/nuxt/nuxt.js/issues/3465
To Reproduce Steps to reproduce the behavior:
- Start application
yarn devoryarn build && yarn start - After running the app for some time you will see that the memory increases in a linear fashon

- When a certain memory limit (system or node) is reached the app becomes unresponsive and then crashes
==== JS stack trace =========================================
Security context: 0x2e216fda5ee1 <JSObject>
0: builtin exit frame: parse(this=0x2e216fd89041 <Object map = 0x257018382ba1>,0x289dd282201 <Very long string[392019]>)
1: transformResponse(aka transformResponse) [/app/node_modules/axios/lib/defaults.js:~56] [pc=0x22fafc4eb551](this=0x4151f882311 <undefined>,data=0x289dd282201 <Very long string[392019]>)
2: arguments adaptor frame: 2->1
4: transform(aka transform) [/app/node_...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x121a2cc [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewFixedArray(int, v8::internal::PretenureFlag) [node]
6: v8::internal::JsonParser<true>::ParseJsonArray() [node]
7: v8::internal::JsonParser<true>::ParseJsonValue() [node]
8: v8::internal::JsonParser<true>::ParseJsonObject() [node]
9: v8::internal::JsonParser<true>::ParseJsonValue() [node]
10: v8::internal::JsonParser<true>::ParseJsonObject() [node]
11: v8::internal::JsonParser<true>::ParseJsonValue() [node]
12: v8::internal::JsonParser<true>::ParseJsonArray() [node]
13: v8::internal::JsonParser<true>::ParseJsonValue() [node]
14: v8::internal::JsonParser<true>::ParseJsonObject() [node]
15: v8::internal::JsonParser<true>::ParseJsonValue() [node]
16: v8::internal::JsonParser<true>::ParseJsonArray() [node]
17: v8::internal::JsonParser<true>::ParseJsonValue() [node]
18: v8::internal::JsonParser<true>::ParseJsonObject() [node]
19: v8::internal::JsonParser<true>::ParseJsonValue() [node]
20: v8::internal::JsonParser<true>::ParseJson() [node]
21: v8::internal::Builtin_JsonParse(int, v8::internal::Object**, v8::internal::Isolate*) [node]
22: 0x22fafb50441d
Aborted
Expected behavior Memory should not increase constantly and not crash after all
Status`?
Codename Nitro will fix it, stay tuned. Will be communicated the next days.
Status?
Nitro is introduced and will be released i think at the end of this year?
Ok and do we have a workaround for the meantime? Christmas-Traffic is coming :/
As we are closed at the moment we do not have to do a workaround as the app restarts anyway and the user is not affected by this to much.
The issue comes from the ssr plugins, we can’t just switch them off easily but address this in nitro from the beginning.
This is still happening. Any updates on this?