etcdserver: wait for snapshots before closing raft

Fixes #5374
This commit is contained in:
Anthony Romano
2016-05-17 14:16:29 -07:00
parent a663828a32
commit 73204e9637
2 changed files with 11 additions and 5 deletions

View File

@ -542,12 +542,13 @@ func (s *EtcdServer) run() {
defer func() {
sched.Stop()
// wait for snapshots before closing raft so wal stays open
s.wg.Wait()
// must stop raft after scheduler-- etcdserver can leak rafthttp pipelines
// by adding a peer after raft stops the transport
s.r.stop()
s.wg.Wait()
// kv, lessor and backend can be nil if running without v3 enabled
// or running unit tests.
if s.lessor != nil {