FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

sarbazx
TRIAL

9 months ago

Failed to build payloadcms project:

<--- Last few GCs --->

[420:0x4cc5000] 119405 ms: Scavenge (interleaved) 2028.4 (2059.7) -> 2027.4 (2059.7) MB, pooled: 0 MB, 2.86 / 0.00 ms (average mu = 0.178, current mu = 0.192) allocation failure;

[420:0x4cc5000] 119969 ms: Mark-Compact 2065.1 (2096.2) -> 2038.3 (2071.9) MB, pooled: 0 MB, 522.82 / 0.00 ms (average mu = 0.158, current mu = 0.142) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

----- Native stack trace -----

1: 0xd141a2 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]

2: 0x1100c00 v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, v8::OOMDetails const&) [node]

3: 0x1100fc4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, v8::OOMDetails const&) [node]

4: 0x133e897 [node]

5: 0x1356e03 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]

6: 0x132e4a1 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

7: 0x132ef75 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

8: 0x130b179 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]

9: 0x1772275 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate) [node]

10: 0x7fc97e5ec8c9

Aborted

 ELIFECYCLE  Command failed with exit code 134.

error building image: error building stage: failed to execute command: waiting for process to exit: exit status 134

exit status 134

Stopping Container

how to fix this?

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

Closed

8 Replies

9 months ago

Hello,

Try setting a service variable NODE_OPTIONS= to --max-old-space-size=8192 so that Node doesn't try to use more memory than your plan allows for.


brody

Hello,Try setting a service variable NODE_OPTIONS= to --max-old-space-size=8192 so that Node doesn't try to use more memory than your plan allows for.

5 months ago

hmm i get the the issue with my Team Pro Plan (32 GB mem).. i try to deploy a nuxt 3 application - but its an old one. i updated only some lines of code.


5 months ago

Have you tried my suggestion?


brody

Have you tried my suggestion?

5 months ago

I think it can not be the solution. I had 32 GB of ram and the application run on 100mb.. so I only changes some lines of code, it’s an already running prod instance

https://help.railway.com/questions/fatal-error-reached-heap-limit-allocati-b8791a0d


5 months ago

It cannot hurt to try.


brody

It cannot hurt to try.

5 months ago

Sorry but I don’t get your point. I should try to add a workaround without any clue or understanding to solve the problem? That doesn't seem entirely logical to me and doesn't give me a feeling of security


brody

It cannot hurt to try.

5 months ago

and there are much more reports https://help.railway.com/questions/node-js-java-script-heap-out-of-memory-be226eab

I think it should be checked, why it happens


5 months ago

The build error does not consist in a platform issue for Railway.

Best,
Brody