appium: Allocation failed - JavaScript heap out of memory
The problem
Seeing this error a lot in the latest Appium (1.18.0):
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Environment
- Appium version (or git revision) that exhibits the issue: 1.18.0
- Last Appium version that did not exhibit the issue (if applicable): 1.17.1
- Desktop OS/version used to run Appium: Ubuntu 18.04
- Node.js version (unless using Appium.app|exe): 10.22.0
- Npm or Yarn package manager: npm 6.14.6
- Mobile platform/version under test: android
- Real device or emulator/simulator: real
- Appium CLI or Appium.app|exe: cli
Details
Here is one example that includes a call stack. More examples can be found in the log file linked to below.
<--- Last few GCs --->
[7337:0x33518d0] 69164275 ms: Mark-sweep 1340.9 (1435.6) -> 1333.5 (1436.1) MB, 1932.9 / 0.1 ms (average mu = 0.296, current mu = 0.286) allocation failure scavenge might not succeed
[7337:0x33518d0] 69167285 ms: Mark-sweep 1341.1 (1436.1) -> 1333.7 (1436.1) MB, 1950.5 / 0.1 ms (average mu = 0.326, current mu = 0.352) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x3cd0ac3dbe1d]
1: StubFrame [pc: 0x3cd0ac3e0c75]
Security context: 0x0bc74961e6c1 <JSObject>
2: getResponseHeader [0x29e852f299f9] [/home/deployer/node_modules/appium/node_modules/morgan/index.js:~350] [pc=0x3cd0b0136729](this=0x29e852f2b659 <JSFunction morgan (sfi = 0x3eeb3f04b91)>,req=0x218092090621 <IncomingMessage map = 0x3ed99199fe19>,res=0x218092090911 <ServerResponse map = 0x3ed99198d991>,field=0x2c35...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x8fb090 node::Abort() [node]
2: 0x8fb0dc [node]
3: 0xb033ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb035e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xef7642 [node]
6: 0xef7748 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
7: 0xf03822 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xf04154 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xf06dc1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
10: 0xed0244 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
11: 0x117031e v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0x3cd0ac3dbe1d
[ADB] Cannot sort build-tools folders ["27.0.1","debian"] by semantic version names.
[ADB] Falling back to sorting by modification date. Original error: Invalid Version: debian
Link to Appium logs
https://gist.github.com/sshock/afa15b1d2b32944e6aee227475ce8f60
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
check this answer: https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory/66914674#66914674
Good to know, thanks. Also, it’s looking great so far. No oom crashes and memory holding steady around 940M virt and 129M res. Keeping my fingers crossed and will continue to check on it throughout the week.