When starting the node with unit-e -reindex, the client eats up all the RAM and is killed by the OOM killer.
This happens because unit-e first reads the entire blockchain and constructs the FinalizationState objects for all of them, and only as a last step calls ActivateBestChain, which trims the FinalizationStates for the finalized blocks:
When starting the node with
unit-e -reindex
, the client eats up all the RAM and is killed by the OOM killer.This happens because unit-e first reads the entire blockchain and constructs the
FinalizationState
objects for all of them, and only as a last step callsActivateBestChain
, which trims theFinalizationState
s for the finalized blocks:To mitigate the issue, we could call
ActivateBestChain
during the import process, every X blocks, where X is a multiple of the epoch length.See also #1073.