MIT6.824-2017-Chinese
MIT6.824-2017-Chinese copied to clipboard
Bug panic: runtime error: index out of range [24] with length 19
修改了 applyLog, 不知为何之前的 ApplyMsg 的参数不能fit autograder...
func (rf *Raft) applyLog() { rf.mu.Lock() defer rf.mu.Unlock() if rf.commitIndex > rf.lastApplied { for i := rf.lastApplied + 1; i <= rf.commitIndex; i++ { var msg ApplyMsg msg.CommandIndex = i msg.Command = rf.log[i].Command msg.CommandValid = true rf.applyCh <- msg } } }
In term 34: Server 0 transfer from CANDIDATE to FOLLOWER Server 1 send vote req failed. Server 1 send vote req failed. panic: runtime error: index out of range [24] with length 19
goroutine 49470632 [running]: raft/raft.(*Raft).broadcastAppendEntries.func1(0x0) /Users/chihuiyang/Developer/UIUC/raft-mp2/src/raft/raft.go:468 +0x454 raft/raft.(*Raft).broadcastAppendEntries.func2(0x140001640c0?) /Users/chihuiyang/Developer/UIUC/raft-mp2/src/raft/raft.go:511 +0x38 created by raft/raft.(*Raft).broadcastAppendEntries /Users/chihuiyang/Developer/UIUC/raft-mp2/src/raft/raft.go:509 +0x128 exit status 2 FAIL raft/raft 48.910s