fix: improve heap size limit log (#8516)

**Motivation**

- got "heap size limit too low" warn in our Bun instance but has no idea
what's the exact value of it

**Description**

- include `heapSizeLimit` in the log

---------

Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com>
This commit is contained in:
twoeths
2025-10-09 17:16:55 +07:00
committed by GitHub
parent f657221d88
commit 793f92c091

View File

@@ -7,7 +7,7 @@ import {ChainForkConfig, createBeaconConfig} from "@lodestar/config";
import {LevelDbController} from "@lodestar/db/controller/level";
import {LoggerNode, getNodeLogger} from "@lodestar/logger/node";
import {ACTIVE_PRESET, PresetName} from "@lodestar/params";
import {ErrorAborted, bytesToInt} from "@lodestar/utils";
import {ErrorAborted, bytesToInt, formatBytes} from "@lodestar/utils";
import {ProcessShutdownCallback} from "@lodestar/validator";
import {BeaconNodeOptions, getBeaconConfigFromArgs} from "../../config/index.js";
import {getNetworkBootnodes, getNetworkData, isKnownNetworkName, readBootnodes} from "../../networks/index.js";
@@ -44,7 +44,7 @@ export async function beaconHandler(args: BeaconArgs & GlobalArgs): Promise<void
const heapSizeLimit = getHeapStatistics().heap_size_limit;
if (heapSizeLimit < EIGHT_GB) {
logger.warn(
`Node.js heap size limit is too low, consider increasing it to at least ${EIGHT_GB}. See https://chainsafe.github.io/lodestar/faqs/#running-a-beacon-node for more details.`
`Node.js heap size limit is too low at ${formatBytes(heapSizeLimit)}, consider increasing it to at least ${formatBytes(EIGHT_GB)}. See https://chainsafe.github.io/lodestar/faqs/#running-a-beacon-node for more details.`
);
}