dfinity / motoko

Simple high-level language for writing Internet Computer canisters
Apache License 2.0
502 stars 98 forks source link

Necessary tasks to make `--compacting-gc` the default #2994

Open ggreif opened 2 years ago

ggreif commented 2 years ago

(YOU CAN LOOK, BUT THINKOS MAY BE INSIDE...)

8459514233 reverted the GC strategy to copying, this is the commit that needs to be backed out.

Methods with pros/cons

So I propose to do the dumbest thing that works, for now. From what I understood we have two alternatives:

Hazards

Several hazards lurk in the upgrade process

The danger of overshooting the serialisation buffers is intuitively tallied in the following table.

(TABLE TO BE FINALISED🔴🟠🟡🟢) method serialisation ser-hazard deserialisation deser-hazard prob. of heap overshoot on upgrade
alloc-check heap buffered 1 GB buffer too small 🟡 heap buffered 1 GB buffer too small 🟠 middle
alloc-check streamed stable memory exhausted 🟢 heap buffered 1 GB buffer too small 🟠 low
alloc-check heap buffered 1 GB buffer too small 🟡 streamed 3 GB heap too small 🟢 middle
alloc-check streamed stable memory exhausted 🟢 streamed 3 GB heap too small 🟠 middle
post-GC-check heap buffered <1 GB buffer too small 🟠 heap buffered >3 GB heap too small 🟢 middle
post-GC-check streamed stable memory exhausted 🟡 heap buffered buffer and heap > 4 GB 🔴 high
post-GC-check heap buffered <1 GB buffer too small 🟠 streamed >3 GB heap too small 🟢 low
post-GC-check streamed stable memory exhausted 🟡 streamed 4 GB heap too small 🔴 high

TODO: a similar table for cycle exhaustion

crusso commented 2 years ago

Another lurking hazard is stack overflow on serialization/deserialization for deeply nested structures.