question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allocation failed - JavaScript heap out of memory

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sshockcommented, Sep 2, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
A common problem while working on a JavaScript Node.js project is the “JavaScript heap out of memory” error. This error usually occurs when ......
Read more >
JavaScript heap out of memory - Snyk Support
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >
Node.js heap out of memory - Stack Overflow
I have a 64-bit CPU and I've installed x86 node version, which caused the CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ......
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
A quick solution that you can use to fix "Heap Out Of Memory Error" in JavaScript. We lay out the causes and how...
Read more >
How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. ... Alternatively, you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found