Browse Source

fixed potential deadlock when a heartbeat request fails

Andreas Schneider 6 years ago
parent
commit
6c949c05b2
1 changed files with 6 additions and 0 deletions
  1. 6 0
      consumer_group.go

+ 6 - 0
consumer_group.go

@@ -657,6 +657,12 @@ func (s *consumerGroupSession) heartbeatLoop() {
 		resp, err := s.parent.heartbeatRequest(coordinator, s.memberID, s.generationID)
 		if err != nil {
 			_ = coordinator.Close()
+
+			if retries <= 0 {
+				s.parent.handleError(err, "", -1)
+				return
+			}
+
 			retries--
 			continue
 		}