Dgraph server terminate when receive predicates
version
Dgraph version : v1.0.2-dev
Commit SHA-1 : 646e7795
Commit timestamp : 2018-01-18 17:13:04 +1100
Branch : HEAD
spec
OS: Coreos beta 1632.1.0 RAM: 32GiB (aws ec2 instance m4.xlarge)
How do I run dgraph
Use Docker.
$ dgraph zero --my <private_ip>:5080 --port_offset -2000 --idx 1
$ dgraph server --my <private_ip>:7080 --zero <private_ip>:5080 --memory_mb 16384 --idx 11
- Up zero and execute bulk loading
dgrpah bulk -s schema -r rdf --zero_addr <private_ip>:5080 --http localhost:8000 --reduca_shards 1 --map_shards=2
- Up dgraph server in same instance
- Add two nodes to above cluster
- . Each instance running zero and server
After add nodes, first zero try to move predicates that generated with bulk loader. Bad crash server by out of memory… However I set memory config referring to Get started — Dgraph Doc v1.0.2.
server log
2018/01/18 12:27:36 predicate_move.go:52: Writing 147968 keys
2018/01/18 12:27:36 predicate_move.go:52: Writing 148298 keys
2018/01/18 12:27:37 predicate_move.go:52: Writing 147986 keys
2018/01/18 12:27:37 predicate_move.go:52: Writing 148072 keys
2018/01/18 12:27:37 predicate_move.go:52: Writing 148116 keys
2018/01/18 12:27:38 predicate_move.go:52: Writing 147975 keys
2018/01/18 12:27:38 predicate_move.go:52: Writing 148065 keys
2018/01/18 12:27:39 predicate_move.go:52: Writing 147872 keys
2018/01/18 12:27:39 predicate_move.go:52: Writing 148079 keys
2018/01/18 12:27:39 predicate_move.go:52: Writing 148171 keys
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0x131661e, 0x16)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/panic.go:605 +0x95
runtime.sysMap(0xcb8f850000, 0x2010000, 0x0, 0x1aaa658)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mem_linux.go:216 +0x1d0
runtime.(*mheap).sysAlloc(0x1a91120, 0x2010000, 0x7f77670fa390)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/malloc.go:470 +0xd7
runtime.(*mheap).grow(0x1a91120, 0x1001, 0x0)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mheap.go:887 +0x60
runtime.(*mheap).allocSpanLocked(0x1a91120, 0x1001, 0x1aaa668, 0x7f7766cf0cb0)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mheap.go:800 +0x334
runtime.(*mheap).alloc_m(0x1a91120, 0x1001, 0x7f76cffe0101, 0x8c585c)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mheap.go:666 +0x118
runtime.(*mheap).alloc.func1()
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mheap.go:733 +0x4d
runtime.systemstack(0x7f76cffe6e10)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/asm_amd64.s:360 +0xab
runtime.(*mheap).alloc(0x1a91120, 0x1001, 0x7f76cf010101, 0x8c4ec4)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/mheap.go:732 +0xa1
runtime.largeAlloc(0x2000126, 0x7f7e16ff0101, 0xcb8f53cd06)
/home/travis/.gimme/versions/go1.9.2.linux.amd64/src/runtime/malloc.go:827 +0x98
top (pid 1583 is server)

Do you have any idea to avoid crash by out of memory? Thanks.
Did the new instance went oom while receiving predicates, can you please share the heap profile of the new instance before going oom if you have a way to reproduce the issue. we do throttle predicate move so it shouldn't cause the server to go oom. We will try to reproduce the issue.
ok.
pprof.dgraph.alloc_objects.alloc_space.inuse_objects.inuse_space.001.pb.gz pprof.dgraph.alloc_objects.alloc_space.inuse_objects.inuse_space.002.pb.gz pprof.dgraph.alloc_objects.alloc_space.inuse_objects.inuse_space.003.pb.gz
I fetched these profiles using net/pprof endpoint.
This high memory utilization was due to the proposals kept in memory. Raft keeps the proposals until snapshot happens. We used to keep last 1000 entries without including them in snapshot. Since we have incremental snapshots now we can do snapshot aggressively. Each predicate move proposal consumes 32mb, so it was a lot of memory.
I see.