소스 검색

Merge pull request #6950 from gyuho/fix-readstatec-deadlock

etcdserver: time out when readStateC is blocking
Gyu-Ho Lee 9 년 전
부모
커밋
994e0d2182
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      etcdserver/raft.go

+ 3 - 0
etcdserver/raft.go

@@ -135,6 +135,7 @@ func (r *raftNode) start(rh *raftReadyHandler) {
 	r.applyc = make(chan apply)
 	r.stopped = make(chan struct{})
 	r.done = make(chan struct{})
+	internalTimeout := time.Second
 
 	go func() {
 		defer r.onStop()
@@ -167,6 +168,8 @@ func (r *raftNode) start(rh *raftReadyHandler) {
 				if len(rd.ReadStates) != 0 {
 					select {
 					case r.readStateC <- rd.ReadStates[len(rd.ReadStates)-1]:
+					case <-time.After(internalTimeout):
+						plog.Warningf("timed out sending read state")
 					case <-r.stopped:
 						return
 					}