IBM / sarama

Sarama is a Go library for Apache Kafka.
MIT License
11.57k stars 1.76k forks source link

Not handling `RefreshFrequency` being 0 correctly. #1999

Closed Jason5Lee closed 1 year ago

Jason5Lee commented 3 years ago
Versions

Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.

Sarama Kafka Go
1.26.1 2.12-1.1.1 1.16.7
Configuration

What configuration values are you using for Sarama and Kafka?

saramaConfig = sarama.NewConfig()
saramaConfig.Consumer.Return.Errors = true
saramaConfig.ChannelBufferSize = defaultBufferSize
saramaConfig.Net.MaxOpenRequests = defaultConnectionNum
saramaConfig.Metadata.RefreshFrequency = 0 // disable metadata fetching;
saramaConfig.Version = sarama.V1_1_1_0
Logs
logs: CLICK ME

``` 2021/08/19 20:53:02 Initializing new client 2021/08/19 20:53:02 ClientID is the default of 'sarama', you should consider setting it to something application-specific. 2021/08/19 20:53:02 ClientID is the default of 'sarama', you should consider setting it to something application-specific. 2021/08/19 20:53:02 client/metadata fetching metadata for all topics from broker localhost:9092 2021/08/19 20:53:02 Connected to broker at localhost:9092 (unregistered) 2021/08/19 20:53:02 client/brokers registered new broker #0 at :9092 2021/08/19 20:53:02 Successfully initialized new client 2021/08/19 20:53:02 Initializing new client 2021/08/19 20:53:02 ClientID is the default of 'sarama', you should consider setting it to something application-specific. 2021/08/19 20:53:02 ClientID is the default of 'sarama', you should consider setting it to something application-specific. 2021/08/19 20:53:02 client/metadata fetching metadata for all topics from broker localhost:9092 2021/08/19 20:53:02 Connected to broker at localhost:9092 (unregistered) 2021/08/19 20:53:02 client/brokers registered new broker #0 at :9092 2021/08/19 20:53:02 Successfully initialized new client 2021/08/19 20:53:02 client/metadata fetching metadata for [rebuild] from broker localhost:9092 2021/08/19 20:53:02 client/coordinator requesting coordinator for consumergroup test from localhost:9092 2021/08/19 20:53:02 client/coordinator coordinator for consumergroup test is #0 (:9092) 2021/08/19 20:53:02 ClientID is the default of 'sarama', you should consider setting it to something application-specific. 2021/08/19 20:53:02 Connected to broker at :9092 (registered as #0) 2021/08/19 20:53:02 client/coordinator requesting coordinator for consumergroup test from localhost:9092 2021/08/19 20:53:02 client/coordinator coordinator for consumergroup test is #0 (:9092) panic: non-positive interval for NewTicker goroutine 27 [running]: time.NewTicker(0x0, 0x0) /.local/go/src/time/tick.go:24 +0x151 github.com/Shopify/sarama.(*consumerGroup).loopCheckPartitionNumbers(0xc0002bac60, 0xc0002b43c0, 0x1, 0x4, 0xc000210080) /pkg/mod/github.com/!shopify/sarama@v1.26.1/consumer_group.go:442 +0x66 created by github.com/Shopify/sarama.(*consumerGroup).Consume /pkg/mod/github.com/!shopify/sarama@v1.26.1/consumer_group.go:176 +0x259 ```

Problem Description

The document of the RefreshFrequency states

Set to 0 to disable.

But it seems that it is not handled correctly and causing panic.

github-actions[bot] commented 1 year ago

Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.

dnwe commented 1 year ago

Fixed by #2329