s2b / ddev-vite-sidecar

DDEV add-on that exposes vite dev server on separate subdomain
Apache License 2.0
16 stars 3 forks source link

heap limit Allocation failed - JavaScript heap out of memory #15

Open Tim-Obert opened 4 days ago

Tim-Obert commented 4 days ago

After round about 5 min of running ddev vite I am getting this error:

<--- Last few GCs --->

[3073:0x6c6f5c0]   503107 ms: Scavenge 4017.1 (4127.1) -> 4005.0 (4127.8) MB, 44.29 / 0.00 ms  (average mu = 0.197, current mu = 0.031) allocation failure;
[3073:0x6c6f5c0]   503220 ms: Scavenge 4018.9 (4127.8) -> 4006.9 (4129.6) MB, 25.15 / 0.00 ms  (average mu = 0.197, current mu = 0.031) allocation failure;
[3073:0x6c6f5c0]   506514 ms: Mark-Compact 4018.9 (4129.6) -> 4005.6 (4131.6) MB, 3115.04 / 0.00 ms  (average mu = 0.180, current mu = 0.161) task; scavenge might not succeed

<--- JS stacktrace --->

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

 1: 0xb82d33 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
 2: 0xef0c50 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 3: 0xef0f37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0x1102ad5  [node]
 5: 0x1103064 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 6: 0x1119f54 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [node]
 7: 0x111a76c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 8: 0x10f0a71 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0x10f1c05 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0x10cf256 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
11: 0x152b086 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x7f8403ed9ef6
Aborted

ddev version v1.23.4 Node Version 20

rfay commented 4 days ago

It sounds like you're out of memory. Is this on macOS? If so, how much RAM do you have allocated in your Docker provider? And of course, your code itself could use up the RAM.

Tim-Obert commented 4 days ago

I am on WSL and i didn't change the default allocated RAM of Docker. My Machine has currently 32GB of RAM. The codebase is not very big, but there are much deprication warnings with the sass builder. Maybe is the issue there

rfay commented 4 days ago

The default on WSL2 on a 32GB machine would be 16GB allocated to WSL2, and if you're using docker-ce, it would have access to all of that, which is a lot. Do use top or other tools to look at this.

Could you provide the file output of ddev debug test ? Thanks.

Or is this report from the browser? If from the browser, it's a completely different thing.

s2b commented 4 days ago

I had similar issues in the past, either when vite scans too many files (that's why I added an ignore list to my vite plugin), or when the composer.json is missing/invalid and vite tries to index more than the current project. I haven't looked into the details yet, maybe those details already help for your analysis?