4

So I was using my bot but since it didn't respond, I decided to check why it was offline. I opened up my code and I found this error in the console. I just wanna know what it means. Here :

<--- Last few GCs --->

[880:0x4b70e20] 26014144 ms: Mark-sweep 234.2 (257.5) -> 234.2 (257.8) MB, 2824.5 / 0.0 ms  (average mu = 0.148, current mu = 0.008) allocation failure scavenge might not succeed
[880:0x4b70e20] 26017038 ms: Mark-sweep 234.6 (257.8) -> 234.5 (257.8) MB, 2888.0 / 0.0 ms  (average mu = 0.081, current mu = 0.002) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

Security context: 0x1f02f9e808d1 <JSObject>
    0: builtin exit frame: parse(this=0x1f02f9e9ee79 <Object map = 0x1cdd4fa03639>,0x15196d9c0119 <Very long string[8081560]>,0x1f02f9e9ee79 <Object map = 0x1cdd4fa03639>)

    1: onMessage [0x118b705220e9] [/home/runner/New-Neptune/node_modules/discord.js/src/client/websocket/WebSocketShard.js:~278] [pc=0x2bb58926f89e](this=0x3f8662a33761 <EventEmitter map = 0x2d550d1ce3a9>,0x1166c1f7f291 <Even...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa1a640 node::Abort() [node]
 2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]
 3: 0xb9a68e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xb9aa09 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd57c85  [node]
 6: 0xd58316 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0xd64bd5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
 8: 0xd65a85 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xd6853c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd363dc v8::internal::Factory::NewRawOneByteString(int, v8::internal::AllocationType) [node]
11: 0xe4561b v8::internal::JsonParser<unsigned short>::MakeString(v8::internal::JsonString const&, v8::internal::Handle<v8::internal::String>) [node]
12: 0xe47e9e v8::internal::JsonParser<unsigned short>::ParseJsonValue() [node]
13: 0xe486af v8::internal::JsonParser<unsigned short>::ParseJson() [node]
14: 0xc4bc05 v8::internal::Builtin_JsonParse(int, unsigned long*, v8::internal::Isolate*) [node]
15: 0x140df99  [node]
 
Darshan B
  • 658
  • 1
  • 5
  • 19

2 Answers2

6

JavaScript heap out of memory

It ran out of memory.

Without seeing your code, it's impossible to say why in particular, but seeing Builtin_JsonParse in the stack means it was probably parsing a big JSON response from somewhere.

AKX
  • 152,115
  • 15
  • 115
  • 172
0

In my case, I was pre autopopulating my document with fields that reference see here its own model...When I tried to hit my API with new data it was working fine like in my case when I was logging in with new signup data it was working fine but with old login data, it was running an infinite loop due to autopopulate which further caused heap out of memory issue..I just realized when I turned on mongoose debugger....After removing those autopopulates my application is working fine

removing autopopulate

Then I removed these autopopulate statements from my code and now it's working fine