{"action":"created","issue":{"url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/144","labels_url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/144/comments","events_url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/144/events","html_url":"https://github.com/chrislusf/seaweedfs/issues/144","id":78054910,"number":144,"title":"Raft leader election bug？","user":{"login":"yanyiwu","id":2162645,"avatar_url":"https://avatars.githubusercontent.com/u/2162645?v=3","gravatar_id":"","url":"https://api.github.com/users/yanyiwu","html_url":"https://github.com/yanyiwu","followers_url":"https://api.github.com/users/yanyiwu/followers","following_url":"https://api.github.com/users/yanyiwu/following{/other_user}","gists_url":"https://api.github.com/users/yanyiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/yanyiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanyiwu/subscriptions","organizations_url":"https://api.github.com/users/yanyiwu/orgs","repos_url":"https://api.github.com/users/yanyiwu/repos","events_url":"https://api.github.com/users/yanyiwu/events{/privacy}","received_events_url":"https://api.github.com/users/yanyiwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-19T11:45:27Z","updated_at":"2015-05-19T16:15:08Z","closed_at":null,"body":"I have 3 master(m0,m1,m2) and 2 volume(v0,v1) in 2 machines(d0,d1).\r\n\r\n+ d0: m0, m2, v0\r\n+ d1: m1, v1\r\n\r\nWhen I start m0 and m2 in d0,  if I start them both in one second(m0 first),  sometimes m2 would crash and log error as following:  \r\n\r\n```\r\nI0519 15:24:12 12345 master_server.go:93] [ ds0.xxbtest.com:9335 ] I am the leader!\r\npanic: assertion failed: leader.elected.at.same.term.28\r\n\r\n\r\ngoroutine 15 [running]:\r\ngithub.com/goraft/raft._assert(0xbec200, 0xca22f0, 0x1f, 0xc2081b1c98, 0x1, 0x1)\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/util.go:60 +0xcf\r\ngithub.com/goraft/raft.(*server).processAppendEntriesRequest(0xc208116b40, 0xc20813e050, 0xc20813e050, 0xc20813e050)\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/server.go:948 +0x413\r\ngithub.com/goraft/raft.(*server).leaderLoop(0xc208116b40)\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/server.go:849 +0x769\r\ngithub.com/goraft/raft.(*server).loop(0xc208116b40)\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/server.go:609 +0x458\r\ngithub.com/goraft/raft.func·007()\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/server.go:470 +0x6a\r\ncreated by github.com/goraft/raft.(*server).Start\r\n        /home/yanyiwu/golang/src/github.com/goraft/raft/server.go:471 +0x4a8\r\n\r\ngoroutine 1 [IO wait]:\r\nnet.runtime_pollWait(0x7fc39bdd8400, 0x72, 0x8)\r\n        /home/yanyiwu/local/go/src/runtime/netpoll.go:149 +0x63\r\n......\r\n```\r\n\r\nI use the weed which is built from commit 5c760523be1b48af4f831db8cfc969e937591a6a \r\n"},"comment":{"url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/comments/103571316","html_url":"https://github.com/chrislusf/seaweedfs/issues/144#issuecomment-103571316","issue_url":"https://api.github.com/repos/chrislusf/seaweedfs/issues/144","id":103571316,"user":{"login":"chrislusf","id":1543151,"avatar_url":"https://avatars.githubusercontent.com/u/1543151?v=3","gravatar_id":"","url":"https://api.github.com/users/chrislusf","html_url":"https://github.com/chrislusf","followers_url":"https://api.github.com/users/chrislusf/followers","following_url":"https://api.github.com/users/chrislusf/following{/other_user}","gists_url":"https://api.github.com/users/chrislusf/gists{/gist_id}","starred_url":"https://api.github.com/users/chrislusf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrislusf/subscriptions","organizations_url":"https://api.github.com/users/chrislusf/orgs","repos_url":"https://api.github.com/users/chrislusf/repos","events_url":"https://api.github.com/users/chrislusf/events{/privacy}","received_events_url":"https://api.github.com/users/chrislusf/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T16:15:08Z","updated_at":"2015-05-19T16:15:08Z","body":"Both m0 and m2 think they are leader themselves. We can fix this by putting a randomized wait before starting raft server."}}