funmaker / Hybooru

Hydrus-based booru-styled imageboard in React
https://booru.funmaker.moe/
MIT License
100 stars 17 forks source link

JavaScript heap out of memory #32

Closed KamillaPup closed 1 year ago

KamillaPup commented 1 year ago

I'm running this for the first time and getting FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I tried running npm install -g increase-memory-limit and it didn't seem to help :<

Full trace


Environment: production.
Press Ctrl-C to terminate.

Database update detected, rebuilding...

Rebuilding Database!

Posts (322730/322730)           [####################] Done in 2.93s
Posts (47825/47825)             [####################] Done in 583ms
Posts (1411/1411)               [####################] Done in 23ms
Posts (7/7)                     [####################] Done in 3ms
Posts (2/2)                     [####################] Done in 2ms
Urls (516731/516731)            [####################] Done in 1.86s
Tags (289520/289520)            [####################] Done in 870ms
Mappings (4087180/4087180)      [####################] Done in 4.59s
Tag parents (6027/6027)         [####################] Done in 32ms
Tag siblings (6417/6417)        [####################] Done in 53ms
Importing options...            [####################] Done in 19ms
Resolving file relations...     [--------------------] 
<--- Last few GCs --->

[2830:0x558074975980]    45042 ms: Scavenge 2034.8 (2073.1) -> 2034.4 (2077.8) MB, 6.0 / 0.0 ms  (average mu = 0.166, current mu = 0.134) allocation failure;  
[2830:0x558074975980]    45056 ms: Scavenge 2037.6 (2077.8) -> 2036.5 (2078.6) MB, 7.8 / 0.0 ms  (average mu = 0.166, current mu = 0.134) allocation failure;  
[2830:0x558074975980]    45069 ms: Scavenge 2038.3 (2078.6) -> 2037.5 (2088.6) MB, 9.6 / 0.0 ms  (average mu = 0.166, current mu = 0.134) allocation failure;  

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x7f2e33600c6c node::Abort() [/lib/x86_64-linux-gnu/libnode.so.108]
 2: 0x7f2e334f42ac  [/lib/x86_64-linux-gnu/libnode.so.108]
 3: 0x7f2e3398b5b4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.108]
 4: 0x7f2e3398b9a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.108] 
 5: 0x7f2e33b74a59  [/lib/x86_64-linux-gnu/libnode.so.108]
 6: 0x7f2e33b74b3d  [/lib/x86_64-linux-gnu/libnode.so.108]
 7: 0x7f2e33b89b89 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.108]
 8: 0x7f2e33b8aaf2 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.108]
 9: 0x7f2e33b8b920 v8::internal::Heap::CollectAllGarbage(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.108] 
10: 0x7f2e33b0b408 v8::internal::StackGuard::HandleInterrupts() [/lib/x86_64-linux-gnu/libnode.so.108]
11: 0x7f2e33f44b5a v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.108]
12: 0x7f2e3389b379  [/lib/x86_64-linux-gnu/libnode.so.108]
Aborted (core dumped)```
KamillaPup commented 1 year ago

I solved it myself! But leaving this for future people frustrated.

Run this in the folder you have the production release in: export NODE_OPTIONS="--max-old-space-size=8192"