2

The build of my React app fails with a (after two days of trials) horrendous 'JavaScript heap out of memory'.

I've tried the suggestions in many posts including:

This one ("many" as "after that tenth try you could say you've tried 'many and any' option).

But all result in failure.

<--- Last few GCs --->

[12207:0x4e75380]   177858 ms: Mark-sweep (reduce) 2044.8 (2080.0) -> 2042.4 (2073.5) MB, 938.5 / 0.1 ms  (+ 350.7 ms in 41 steps since start of marking, biggest step 18.9 ms, walltime since start of marking 1302 ms) (average mu = 0.154, current mu = 0.10[12207:0x4e75380]   177863 ms: Scavenge 2043.5 (2073.5) -> 2042.6 (2074.5) MB, 2.6 / 0.0 ms  (average mu = 0.154, current mu = 0.103) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb200e0 node::Abort() [node]
 2: 0xa3c157 node::FatalError(char const*, char const*) [node]
 3: 0xd083ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd08727 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xee9785  [node]
 6: 0xeea2cc  [node]
 7: 0xef8269 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 8: 0xefb5ac v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0xec000c v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x123695b v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1640839  [node]

The weird part is the same project fails to load some package inside some of Firebase dependencies, google-gax.

not found

caused by (presumably) bad 'require' calling

this is unbelievable!

could the memory error be related to this google package "misspelling". A reflect of something being hidden out there in the project.

P.D.: This error only happens in this branch. Other branches of the same project don't fail.

P.D.: The google-gax bad require mut be corrected (manually) in order to compile (or try to do so) the project.

mbastidasluis
  • 39
  • 1
  • 7

1 Answers1

0

I believe both the errors, heap out of memory error and bad require calling error are independent of each other. So providing separate solutions for both.

For the bad require calling error see the below links :

For the node.js heap out of memory error :

  • Can you please run the below command and confirm what the output is? require('v8').getHeapStatistics().total_available_size

  • Are you using Maps in Node.js because then this might be the cause. Providing a solution for this, if yes.

  • Please refer to this link, you can find multiple workarounds for this open issue in Github #8096

  • Also see this you are starting your service with node. But if you are starting your service with supervisorctl start <servicename> then see this.

Gourav B
  • 864
  • 5
  • 17
Priyashree Bhadra
  • 3,182
  • 6
  • 23