使用nuxt 2的节点内存泄漏

时间:2018-11-15 14:46:15

标签: javascript node.js vue.js nuxt.js

好吧,我的应用程序有点大,突然间我开始遇到一些崩溃,我认为这是随机的,只会发生一次。

一旦它开始发生更多次(在开发几分钟后崩溃,也许会在20到30分钟后崩溃),我不知道它到底是什么,后来我才发现这是内存泄漏。 / p>

首先,我删除了一些全局混合器,并将它们转换为原型,这样它们只能被包含一次,但不能解决问题。

我更新到nuxt 2,因为我知道它可以更好地解决此问题,但这并不能解决,也没有提供有关它可能在哪里以及触发它的原因的更多信息。

我遇到这个问题已有一段时间了,似乎没有人能指出正确的方向,而且我不知道从哪里开始或该怎么做才能找到罪魁祸首,我希望有人遇到了类似的问题,可以指出正确的方向。

我得到的错误转储如下:

<--- Last few GCs --->

[87277:0x103800000]  6485776 ms: Mark-sweep 1349.3 (1457.6) -> 1349.3 (1457.6) MB, 922.3 / 0.0 ms  allocation failure GC in old space requested
[87277:0x103800000]  6486970 ms: Mark-sweep 1349.3 (1457.6) -> 1349.3 (1426.1) MB, 1191.0 / 0.0 ms  last resort GC in old space requested
[87277:0x103800000]  6488029 ms: Mark-sweep 1349.3 (1426.1) -> 1349.3 (1426.1) MB, 1058.7 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0xd2f89325879 <JSObject>
    1: createWriteReq(aka createWriteReq) [net.js:797] [bytecode=0xd2f1f199659 offset=111](this=0xd2f8ce022d1 <undefined>,req=0xd2f39a113c9 <WriteWrap map = 0xd2fd94eb3a1>,handle=0xd2f42ca3499 <TCP map = 0xd2f3d1578c1>,data=0xd2f39a11241 <Very long string[652355]>,encoding=0xd2f893358e9 <String[4]: utf8>)
    2: _writeGeneric [net.js:760] [bytecode=0xd2f1f198401 offset=395](this=0xd2fd0188f41 <So...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 4: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 5: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 6: v8::String::WriteUtf8(char*, int, int*, int) const [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 7: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 8: int node::StreamBase::WriteString<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
 9: void node::StreamBase::JSMethod<node::LibuvStreamWrap, &(int node::StreamBase::WriteString<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
10: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
11: 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/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
12: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/joaopetinga/.nvm/versions/node/v8.11.4/bin/node]
13: 0x50d80d842fd
Abort trap: 6

我已经阅读了多次,但是我无法提取任何有用的信息(我不知道要寻找什么) 我真的需要一些帮助。 预先感谢

0 个答案:

没有答案