Ethereum geth: out of memory

2.5k Views Asked by At

I often got the problem of memory leaks when working with ethereum node (Geth). I could not understand the reason, the problem arose at an indefinite point in time. The server could work for a week, and sometimes it took a day to break. We are developing in the local network: "chainId": 15

My genesis.json

{
"config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
},
"difficulty": "0x400",
"gasLimit": "0x2100000",
"alloc": {
    "7a69b359e86893efa3d9732e4c65ced51567edd0": 
     { "balance": "0x1337000000000000000000" }     
}}

Server side: 4x cpu/8GB memory/Ubuntu 18.04 x64

Command to run:

geth --rpcapi personal,web3,eth --mine --minerthreads 4 --rpccorsdomain '0.0.0.0:5000' --rpc --networkid 1999 --datadir ./ --rpcvhosts 127.0.0.1 --port 30304 --rpcport 8546 --rpcaddr 0.0.0.0

Go version 1.11.1

Geth version 1.8.17-stable-8bbe7207

1

There are 1 best solutions below

0
On

I checked the advice: https://github.com/ethereum/go-ethereum/issues/16377#issuecomment-430642197

I can say that it worked. Our server has been stable for 3 weeks.

My actions:

1.Allow only a specific ip address to an open RPC port on the server where your node is installed:

$ iptables -A INPUT -p tcp --dport [rpc port] -s [ip who is using your node] -j ACCEPT

2.Сhange startup options:

$ geth --rpcapi personal,web3,eth --mine --minerthreads 2 --rpccorsdomain ['ip who is using your node:port'] --rpc --networkid 1999 --datadir ./ --rpcvhosts 127.0.0.1 --port 30304 --rpcport [rpc port] --rpcaddr [ip server where your node is installed]

3.for mining, I do not recommend using all processor cores, let the server breathe easily:

--mine --minerthreads 2

4.servers with large memory are more expensive, for the internal network you should be enough 2GB. Use the SWAP file:

how to turn on: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04

My status after last error: enter image description here