doyensec / electronegativity

Electronegativity is a tool to identify misconfigurations and security anti-patterns in Electron applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

VoidSec opened this issue · comments

Repo: https://github.com/sotch-pr35mac/syng

  • electronegativity -i ./syng -o ./report/syng.csv
41% | 14/34
<--- Last few GCs --->

[7207:0x102803c00]    10076 ms: Scavenge 1394.6 (1422.7) -> 1394.3 (1424.2) MB, 3.0 / 0.0 ms  (average mu = 0.134, current mu = 0.040) allocation failure
[7207:0x102803c00]    11032 ms: Mark-sweep 1395.2 (1424.2) -> 1394.9 (1422.7) MB, 953.5 / 0.0 ms  (average mu = 0.077, current mu = 0.018) allocation failure scavenge might not succeed
[7207:0x102803c00]    11036 ms: Scavenge 1395.8 (1422.7) -> 1395.5 (1424.2) MB, 3.1 / 0.0 ms  (average mu = 0.077, current mu = 0.018) allocation failure


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x30957ec841bd]
    1: StubFrame [pc: 0x30957ec87c1a]
Security context: 0x2b810b81e6c9 <JSObject>
    2: /* anonymous */ [0x2b81354ebcd9] [/usr/local/lib/node_modules/@doyensec/electronegativity/node_modules/esprima/dist/esprima.js:~5849] [pc=0x30957ef59e98](this=0x2b81ec521271 <Scanner map = 0x2b817faf11d1>)
    3: /* anonymous */ [0x2b81354ebe59] [/usr/local/lib/node_modules/@doyensec/electronegativity/node_modules...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100033d65 node::Abort() [/usr/local/bin/node]
 2: 0x100035500 node::FatalTryCatch::~FatalTryCatch() [/usr/local/bin/node]
 3: 0x10019f10a v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x10056d6b2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 5: 0x10056c669 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 6: 0x10056a2f8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 7: 0x10057683c v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 8: 0x1005451d4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
 9: 0x1007cf974 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x30957ec841bd
Abort trap: 6

Doesn't fail on my machine, but I have 32GB... Will be harder to find out, maybe some memory profiling could help.

@VoidSec Could you try --max-old-space-size= with various values?
Like node --max-old-space-size=4096 electronegativity -i ./syng -o ./report/syng.csv

--max-old-space-size=4096 it works! :)