bor icon indicating copy to clipboard operation
bor copied to clipboard

start bor v2.7.3 memory continues to grow until it runs out

Open yangj888 opened this issue 6 months ago • 8 comments

My ec2 96G memory, after start bor, About 5 minutes , memory will run out. i try to modify some value, but no help.

maxpendpeers change 500 to 50
globalslots change 131072 to 4096 globalqueue change 131072 to 1024
maxpeers change 2000 to 50
snapshot set to false

can you help or give some suggestions? thanks.

yangj888 avatar May 08 '26 08:05 yangj888

It would help if we have a pprof when the memory consumption is increasing.

bor debug pprof -address 127.0.0.1:3131 -seconds 60 -output pprof

pratikspatil024 avatar May 18 '26 05:05 pratikspatil024

thanks for your reply, upgrade to v2.8.0 and try to see the memory usage.

yangj888 avatar May 18 '26 09:05 yangj888

I’m experiencing a similar memory issue.

Image Image

Summary

The 16.47 GB resident heap is dominated by two structural costs in pathdb's flush path:

  1. 47% — single-shot pebble batch allocation. (*buffer).flush.func1 calls db.NewBatchWithSize((flushNodes.dbsize() + flushStates.dbsize()) * 11/10). For Polygon-style workloads, the dbsize estimator inflates a ~2 GB in-memory buffer into a ~7.6 GB contiguous rawalloc. Pebble then materializes another ~1.2 GB flushable batch when the write commits.
  2. 19% — copy-on-write storage map clones. (*stateSet).merge invokes writableStorage for every account whose storage submap is shared with a frozen-but-not-yet-flushed buffer. Each call allocates a fresh map[Hash][]byte and copies all entries, regardless of how many slots actually changed.

AI suggests me try to lower cache.gc. I changed config "cache" from 10240 (10GiB) to 5120 (5GiB)

enable debug log and restart bor, Persisted buffer content logs shows:

t=2026-05-18T12:46:34.834570+0000 lvl=debug msg="Persisted buffer content" nodes=315022 accounts=229530 slots=3642724 bytes="367.44 MiB" elapsed=4.237s t=2026-05-18T12:46:50.808426+0000 lvl=debug msg="Persisted buffer content" nodes=314479 accounts=231574 slots=3683816 bytes="370.59 MiB" elapsed=4.145s t=2026-05-18T12:49:27.908318+0000 lvl=debug msg="Persisted buffer content" nodes=315273 accounts=233477 slots=3724569 bytes="373.46 MiB" elapsed=3.917s t=2026-05-18T12:52:54.343616+0000 lvl=debug msg="Persisted buffer content" nodes=316978 accounts=235814 slots=3766767 bytes="376.93 MiB" elapsed=3.750s t=2026-05-18T13:04:02.491374+0000 lvl=debug msg="Persisted buffer content" nodes=837299 accounts=243613 slots=3905611 bytes="540.63 MiB" elapsed=5.382s t=2026-05-18T13:14:44.961184+0000 lvl=debug msg="Persisted buffer content" nodes=835690 accounts=251181 slots=4042626 bytes="550.44 MiB" elapsed=5.416s

sunjiahui avatar May 18 '26 13:05 sunjiahui

@sunjiahui - For now, we recommend gc.cache=0 on mainnet.

pratikspatil024 avatar May 19 '26 15:05 pratikspatil024

@pratikspatil024 I think you mean --cache.gc=0, is simlr to this section in config.content

[cache]
    gc = 0

loglapa avatar May 21 '26 11:05 loglapa

@loglapa - yes. It is the same. One is CLI other one is config file

pratikspatil024 avatar May 21 '26 12:05 pratikspatil024

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jun 05 '26 01:06 github-actions[bot]

This issue was closed because it has been stalled for 28 days with no activity.

github-actions[bot] avatar Jun 19 '26 01:06 github-actions[bot]