Skip to content

Commit

Permalink
Merge pull request #603 from twmb/rp-13791
Browse files Browse the repository at this point in the history
kgo: avoid rare panic
  • Loading branch information
twmb authored Oct 22, 2023
2 parents e94230f + c013050 commit 067ec8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/kgo/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,15 @@ func (c *consumer) startNewSession(tps *topicsPartitions) *consumerSession {
func (s *consumerSession) listOrEpoch(waiting listOrEpochLoads, immediate bool, why string) {
defer s.decWorker()

// It is possible for a metadata update to try to migrate partition
// loads if the update moves partitions between brokers. If we are
// closing the client, the consumer session could already be stopped,
// but this stops before the metadata goroutine is killed. So, if we
// are in this function but actually have no session, we return.
if s == noConsumerSession {
return
}

wait := true
if immediate {
s.c.cl.triggerUpdateMetadataNow(why)
Expand Down

0 comments on commit 067ec8e

Please sign in to comment.