ethstorage / es-node

Golang implementation of the EthStorage node.
Other
1.15k stars 77 forks source link

Possible memory leak from go-rapidsnark #312

Closed syntrust closed 1 month ago

syntrust commented 3 months ago

System information

v0.1.15-808d9af9-1722415992

AX101

Expected behaviour

Actual behaviour

RES(Resident Memory Usage)increases from 900MB up to 2.3GB after 30 hours and about 20 mining submissions.

Steps to reproduce the behaviour

Run es-node using --miner.zk-prover-impl 2

Backtrace

Using pprof shows the memory generated by wazero.NewCircom2WZWitnessCalculator (used by go-rapidsnark prover) is increasing.

Showing top 10 nodes out of 44
      flat  flat%   sum%        cum   cum%
     520MB 70.72% 70.72%      520MB 70.72%  github.com/syndtr/goleveldb/leveldb/memdb.New
  169.34MB 23.03% 93.75%   169.34MB 23.03%  github.com/tetratelabs/wazero/internal/wasm/binary.decodeDataSegment
   27.98MB  3.81% 97.56%    27.98MB  3.81%  github.com/tetratelabs/wazero/internal/wasm/binary.decodeCode
    0.50MB 0.068% 97.63%   169.84MB 23.10%  github.com/tetratelabs/wazero/internal/wasm/binary.decodeDataSection
         0     0% 97.63%      512MB 69.64%  github.com/ethereum/go-ethereum/core/rawdb.NewLevelDBDatabase
         0     0% 97.63%      512MB 69.64%  github.com/ethereum/go-ethereum/core/rawdb.Open
         0     0% 97.63%      512MB 69.64%  github.com/ethereum/go-ethereum/core/rawdb.openKeyValueDatabase
         0     0% 97.63%      512MB 69.64%  github.com/ethereum/go-ethereum/ethdb/leveldb.New
         0     0% 97.63%      512MB 69.64%  github.com/ethereum/go-ethereum/ethdb/leveldb.NewCustom
         0     0% 97.63%        4MB  0.54%  github.com/ethereum/go-ethereum/p2p/enode.OpenDB
syntrust commented 1 month ago

Fixed by https://github.com/ethstorage/es-node/pull/317