7

Error:

<--- Last few GCs --->

[873:0x1020aa000]    47109 ms: Scavenge 2107.9 (2131.9) -> 2092.1 (2131.9) MB, 0.3 / 0.0 ms  (average mu = 0.995, current mu = 0.999) allocation failure 
[873:0x1020aa000]    47231 ms: Scavenge 2107.9 (2131.9) -> 2092.1 (2131.9) MB, 0.2 / 0.0 ms  (average mu = 0.995, current mu = 0.999) allocation failure 
[873:0x1020aa000]    47353 ms: Scavenge 2107.9 (2131.9) -> 2092.1 (2131.9) MB, 0.2 / 0.0 ms  (average mu = 0.995, current mu = 0.999) allocation failure 


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x27af028cfc7d]
Security context: 0x00a9d921d971 <JSObject>
    1: push [0xa9d9205831](this=0x00a92dc86431 <JSArray[112813858]>,0x00a9f2d5fdf1 <String[17]\: \n                >)
    2: /* anonymous */ [0xa92dc86471] [0x00a9bba025b1 <undefined>:~1] [pc=0x27af02959ff7](this=0x00a9051847e1 <JSGlobal Object>,0x00a92dc86531 <Object map = 0xa982312831>,0x00a9f2d4f6a9 <JSFunction exports.escapeXML (sfi = 0xa9f2d4edc9)>,0x00...

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
 1: 0x100060e87 node::Abort() [/usr/local/Cellar/node/11.10.1/bin/node]
 2: 0x1000614f5 node::OnFatalError(char const*, char const*) [/usr/local/Cellar/node/11.10.1/bin/node]
 3: 0x10017a687 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/11.10.1/bin/node]
 4: 0x10017a628 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/11.10.1/bin/node]
 5: 0x100437638 v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/Cellar/node/11.10.1/bin/node]
 6: 0x10041de6a v8::internal::Factory::AllocateRawFixedArray(int, v8::internal::PretenureFlag) [/usr/local/Cellar/node/11.10.1/bin/node]
 7: 0x10041d781 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [/usr/local/Cellar/node/11.10.1/bin/node]
 8: 0x1003dce56 v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::ConvertElementsWithCapacity(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::FixedArrayBase>, v8::internal::ElementsKind, unsigned int, unsigned int, unsigned int, int) [/usr/local/Cellar/node/11.10.1/bin/node]
 9: 0x1003dcd0c v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacityAndConvertImpl(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/usr/local/Cellar/node/11.10.1/bin/node]
10: 0x1003db82a v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::Add(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, unsigned int) [/usr/local/Cellar/node/11.10.1/bin/node]
11: 0x1005068dc v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [/usr/local/Cellar/node/11.10.1/bin/node]
12: 0x100505a38 v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/usr/local/Cellar/node/11.10.1/bin/node]
13: 0x10060fd43 v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode) [/usr/local/Cellar/node/11.10.1/bin/node]
14: 0x100612c8c v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/Cellar/node/11.10.1/bin/node]
15: 0x27af028cfc7d 
[nodemon] app crashed - waiting for file changes before starting...

I am getting this error every time I run my app.js file and click on a page, it tries to load for a minute without success and then crash. I know this question been asked before.

However, I have tried:

export NODE_OPTIONS=--max_old_space_size=4096

I also tried:

node --max_old_space_size=4096 app.js

and then run my app.js and problem still the same. I am not sure where my exported variables go, cannot find the .bashrc file anywhere etc. I am not even sure what's wrong, I am a bit new into coding.

4

1 Answer 1

6

ANSWER:

I managed to solve it, I had an infinite loop working in the background as @alfasin suggested.

Sign up to request clarification or add additional context in comments.

5 Comments

how did you find the loop?
It's probably a while loop, just do a project-wide search for while and make sure none of them will never terminate, if you still can't figure it out make a post on stackoverflow with all the different loops @katzenhut
@notacorn - thank you, but i was hoping for something more tool-like, like the V8-Profiler mentioned in the questions comments. Manual code analysis tends to be quite slow...
you could console log unique indicators in every loop maybe @katzenhut
I do have infinite loops in my application, which are called every X second. But they shouldn't be causing a problem like this. How do I find the loop that causes this problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.