Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how much memory does geth need? it eat up all my 8 gb memory then crashed #15153

Closed
johnluan opened this issue Sep 16, 2017 · 2 comments
Closed

Comments

@johnluan
Copy link

johnluan commented Sep 16, 2017

System information

Geth version: 1.7.0
OS & Version: Linux 8g ram
Commit hash : (if develop)

Expected behaviour

Geth syncing data normally

Actual behaviour

Geth blow the ram up then crashed.

Steps to reproduce the behaviour

geth --cache=6512 --rpc --rpcaddr=0.0.0.0 --etherbase 0xbaa65ae851612c6a1b10c066cc10c1bfc0b23470 --verbosity=2 --datadir "/data/geth"

Backtrace

Sep 16 09:37:42 10-9-165-200 geth[3391]: fatal error: runtime: out of memory
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime stack:
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.throw(0xf4c0a0, 0x16)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/panic.go:605 +0x95
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.sysMap(0xc5b8d90000, 0x65c00000, 0x0, 0x19303f8)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mem_linux.go:216 +0x1d0
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).sysAlloc(0x1916b40, 0x65c00000, 0x7fe542057688)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/malloc.go:470 +0xd7
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).grow(0x1916b40, 0x32e00, 0x0)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mheap.go:887 +0x60
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).allocSpanLocked(0x1916b40, 0x32e00, 0x1930408, 0x7fe543017d38)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mheap.go:800 +0x334
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).alloc_m(0x1916b40, 0x32e00, 0x7fe567ff0101, 0x41b41c)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mheap.go:666 +0x118
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).alloc.func1()
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mheap.go:733 +0x4d
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.systemstack(0x7fe567ffee10)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/asm_amd64.s:360 +0xab
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.(*mheap).alloc(0x1916b40, 0x32e00, 0x7fe567010101, 0x41aa84)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/mheap.go:732 +0xa1
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.largeAlloc(0x65c00000, 0x7fe578bd0101, 0x45dc5b)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/malloc.go:827 +0x98
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.mallocgc.func1()
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/malloc.go:722 +0x46
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.systemstack(0xc4200607b8)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/asm_amd64.s:344 +0x79
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.mstart()
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/proc.go:1125
Sep 16 09:37:42 10-9-165-200 geth[3391]: goroutine 91421 [running]:
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.systemstack_switch()
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/asm_amd64.s:298 fp=0xc51f382be8 sp=0xc51f382be0 pc=0x460870
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.mallocgc(0x65c00000, 0xd95ae0, 0xdeadbe01, 0xc45e8a2240)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/malloc.go:721 +0x7b8 fp=0xc51f382c90 sp=0xc51f382be8 pc=0x417108
Sep 16 09:37:42 10-9-165-200 geth[3391]: runtime.makeslice(0xd95ae0, 0x0, 0x65c00000, 0x7fe578b74000, 0xc525e58000, 0xc470bc1601)
Sep 16 09:37:42 10-9-165-200 geth[3391]: #11/usr/lib/go-1.9/src/runtime/slice.go:54 +0x77 fp=0xc51f382cc0 sp=0xc51f382c90 pc=0x44a037
Sep 16 09:37:42 10-9-165-200 geth[3391]: github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb/memdb.New(0x1815a60, 0xc4201bfcf0, 0x65c00000, 0x0)
Sep 16 09:37:42 10-9-165-200 geth[3391]:

[backtrace]
@fjl
Copy link
Contributor

fjl commented Sep 16, 2017

Using --cache=6512 makes geth use at least 6.5GB of memory. It should not run out of memory if you use a less extreme number for --cache, like 1024. Please also note that larger cache doesn't really speed things up a lot.

@fjl fjl closed this as completed Sep 16, 2017
@sleimana
Copy link

sleimana commented Mar 10, 2018

I'm syncing in fast mode, and I'm always ~64 block behind the endBlock. I know it's because of the state tries downloading. The problem is that geth keeps being killed, either by SIGKILL or by Supervisor (exit status 2; expected). Thus, the state tries keep resetting to zero and i'm not able to finish syncing.
How can I prevent geth from being killed, or limit the amount of memory it consumes?
I use Geth [1.8.1-stable] on Ubuntu [16.04]. 3GB RAM. SSD.
geth --syncmode "fast" --cache=1536 --rpc --rpcaddr 127.0.0.1 rpcport=8545 --rpcapi "web3,eth,debug" --maxpeers "128"
thanks
EDIT: I solved this by lowering the cache to 768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants