Runtime error related with GC options `--gc-threshold`
freedomhero opened this issue · comments
Describe the bug
I got runtime errors when trying to run a heavy project by ahc-dist
command with --gc-threshold
option. Different errors were throwed according to --gc-threshold
value for the same program. Here's the commands and the corresponding errors:
ahc-dist --input-exe myprog --run
file:///workspace/rts.gc.mjs:466
throw new WebAssembly.RuntimeError();
^
RuntimeError
at GC.evacuateClosure (file:///workspace/rts.gc.mjs:466:15)
at GC.scavengeClosureAt (file:///workspace/rts.gc.mjs:477:34)
at GC.scavengePointersFirst (file:///workspace/rts.gc.mjs:481:41)
at GC.scavengeClosure (file:///workspace/rts.gc.mjs:826:14)
at GC.scavengeLoop (file:///workspace/rts.gc.mjs:750:31)
at GC.performGC (file:///workspace/rts.gc.mjs:1065:10)
at Scheduler.returnedFromTSO (file:///workspace/rts.scheduler.mjs:114:17)
at Scheduler.tick (file:///workspace/rts.scheduler.mjs:355:14)
at Immediate.<anonymous> (file:///workspace/rts.scheduler.mjs:118:33)
at processImmediate (node:internal/timers:463:21)
ahc-dist --input-exe myprog --run --gc-threshold=150
<--- Last few GCs --->
00[13520:0x5d81a10] 72498 ms: Mark-sweep (reduce) 2048.0 (2082.5) -> 2047.3 (2083.0) MB, 2402.3 / 31.9 ms (+ 0.1 ms in 223 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2417 ms) (average mu = 0.065, current mu = 0.00[13520:0x5d81a10] 75356 ms: Mark-sweep (reduce) 2048.3 (2083.0) -> 2047.6 (2083.2) MB, 2846.9 / 30.1 ms (+ 0.1 ms in 223 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2858 ms) (average mu = 0.030, current mu = 0.00
<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
1: 0xa68bf0 node::Abort() [node]
2: 0x99bc4d node::FatalError(char const*, char const*) [node]
3: 0xc433ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xc43727 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xe0d315 [node]
6: 0xe3c8a3 v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, int) [node]
7: 0xe49456 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, long*) [node]
8: 0xe3557f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [node]
9: 0xe357f8 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [node]
10: 0xe27619 v8::internal::ItemParallelJob::Run() [node]
11: 0xe4b3e0 void v8::internal::MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks<v8::internal::FullEvacuator, v8::internal::MarkCompactCollector>(v8::internal::MarkCompactCollector*, v8::internal::ItemParallelJob*, v8::internal::MigrationObserver*, long) [node]
12: 0xe4bc23 v8::internal::MarkCompactCollector::EvacuatePagesInParallel() [node]
13: 0xe4bfe5 v8::internal::MarkCompactCollector::Evacuate() [node]
14: 0xe5e751 v8::internal::MarkCompactCollector::CollectGarbage() [node]
15: 0xe1a618 v8::internal::Heap::MarkCompact() [node]
16: 0xe1bfa8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
17: 0xe1f54c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
18: 0xde346a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
19: 0x1139f2b v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
20: 0x14d0c99 [node]
ahc-dist --input-exe myprog --run --gc-threshold=350
file:///workspace/rts.memory.mjs:101
return this.dataView.getBigUint64(p, true);
^
RangeError: Offset is outside the bounds of the DataView
at DataView.getBigUint64 (<anonymous>)
at Memory.i64Load (file:///workspace/rts.memory.mjs:101:26)
at GC.evacuateClosure (file:///workspace/rts.gc.mjs:255:37)
at GC.scavengeClosureAt (file:///workspace/rts.gc.mjs:477:34)
at GC.scavengePointersFirst (file:///workspace/rts.gc.mjs:481:41)
at GC.scavengeClosure (file:///workspace/rts.gc.mjs:799:14)
at GC.scavengeLoop (file:///workspace/rts.gc.mjs:750:31)
at GC.performGC (file:///workspace/rts.gc.mjs:1065:10)
at Scheduler.returnedFromTSO (file:///workspace/rts.scheduler.mjs:114:17)
at Scheduler.tick (file:///workspace/rts.scheduler.mjs:355:14)
ahc-dist --input-exe myprog --run --gc-threshold=550
JSException
RuntimeError: function signature mismatch
at <anonymous>:wasm-function[4596]:0xdd37f
at scheduleTSO (<anonymous>:wasm-function[4597]:0xdd3ac)
at Scheduler.tick (file:///workspace/rts.scheduler.mjs:347:22)
at Immediate.<anonymous> (file:///workspace/rts.scheduler.mjs:118:33)
at processImmediate (node:internal/timers:463:21)
To Reproduce
It's in a private repo now, sorry for the inconvenience. But I can provide access if needed.
Expected behavior
The expected behavior is only the performance differences when given different values for --gc-threshold
, and the progrom should all end with success.
Environment
- OS name + version: MacOS 12.6
- Version of the code: docker latest
Additional context
Add any other context about the problem here.
Maybe related with #97