epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.32k stars 355 forks source link

Deployment is failing due to swap memory #745

Closed CodingAleCR closed 3 months ago

CodingAleCR commented 3 months ago

Hey all, I've been running a new project, fairly small, but when I try to deploy to Fly, I get errors when doing healthchecks:

2024-05-28T06:06:09.127 app[e28675d4a79558] sjc [info] level=INFO msg="executing command: npx [prisma migrate deploy]"

2024-05-28T06:06:10.531 app[e28675d4a79558] sjc [info] npm WARN exec The following package was not found and will be installed: prisma@5.14.0

2024-05-28T06:06:20.246 app[e28675d4a79558] sjc [info] <--- Last few GCs --->

2024-05-28T06:06:20.246 app[e28675d4a79558] sjc [info] [340:0x5c9e270] 10425 ms: Mark-Compact (reduce) 253.5 (257.7) -> 253.4 (258.4) MB, 600.07 / 0.26 ms (+ 244.6 ms in 188 steps since start of marking, biggest step 69.5 ms, walltime since start of marking 1319 ms) (average mu = 0.567, current mu = 0.553[340:0x5c9e270] 11108 ms: Mark-Compact (reduce) 254.4 (258.4) -> 254.4 (259.4) MB, 667.27 / 0.00 ms (average mu = 0.401, current mu = 0.025) allocation failure; scavenge might not succeed

2024-05-28T06:06:20.246 app[e28675d4a79558] sjc [info] <--- JS stacktrace --->

2024-05-28T06:06:20.247 app[e28675d4a79558] sjc [info] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

2024-05-28T06:06:20.247 app[e28675d4a79558] sjc [info] ----- Native stack trace -----

2024-05-28T06:06:20.264 app[e28675d4a79558] sjc [info] 1: 0xb82c28 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.264 app[e28675d4a79558] sjc [info] 2: 0xeed540 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.265 app[e28675d4a79558] sjc [info] 3: 0xeed827 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.266 app[e28675d4a79558] sjc [info] 4: 0x10ff3c5 [npm exec prisma migrate deploy]

2024-05-28T06:06:20.268 app[e28675d4a79558] sjc [info] 5: 0x1117248 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.269 app[e28675d4a79558] sjc [info] 6: 0x10ed361 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.270 app[e28675d4a79558] sjc [info] 7: 0x10ee4f5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.270 app[e28675d4a79558] sjc [info] 8: 0x10cac16 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.271 app[e28675d4a79558] sjc [info] 9: 0x10bc844 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.272 app[e28675d4a79558] sjc [info] 10: 0x10bfb57 v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString(int, v8::internal::AllocationType) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.272 app[e28675d4a79558] sjc [info] 11: 0x1230927 v8::internal::JsonParser<unsigned short>::MakeString(v8::internal::JsonString const&, v8::internal::Handle<v8::internal::String>) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.273 app[e28675d4a79558] sjc [info] 12: 0x123680d [npm exec prisma migrate deploy]

2024-05-28T06:06:20.274 app[e28675d4a79558] sjc [info] 13: 0x1238779 v8::internal::JsonParser<unsigned short>::ParseJson(v8::internal::Handle<v8::internal::Object>) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.275 app[e28675d4a79558] sjc [info] 14: 0xf7f21e v8::internal::Builtin_JsonParse(int, unsigned long*, v8::internal::Isolate*) [npm exec prisma migrate deploy]

2024-05-28T06:06:20.276 app[e28675d4a79558] sjc [info] 15: 0x1960df6 [npm exec prisma migrate deploy]

2024-05-28T06:06:20.308 app[e28675d4a79558] sjc [info] ERROR: cannot exec: sync cmd: cannot run command: signal: aborted

2024-05-28T06:06:20.320 app[e28675d4a79558] sjc [info] level=INFO msg="F254301428616D5C: exiting primary, destroying lease"

It happens when trying to run migrations but I don't think it's related to the migrations exactly, and instead it's related to the memory configuration somehow. I think this is related: https://github.com/remix-run/indie-stack/issues/276. But I tried adding the swap config to the .toml file and it still failed.