IBM / sarama

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

runtime error: invalid memory address or nil pointer dereference #3005

Open HQ1363 opened 1 day ago

HQ1363 commented 1 day ago
Description

I have multiple producers who send messages to different kafka cluster instances, and their topic names are the same. After the program runs for a period of time, it will suddenly panic.

Versions
Sarama Kafka Go
1.38.1 2.8.2.7 go1.21.3
Configuration
c := sarama.NewConfig()
c.Producer.RequiredAcks = sarama.WaitForAll
c.Producer.Return.Successes = true
c.Producer.Return.Errors = true  
c.Producer.Flush.Messages = 10 
c.Producer.Flush.Frequency = 500 * time.Millisecond 
Logs
logs: CLICK ME

``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xe2589d] goroutine 1599 [running] : github.com/Shopify/sarama.(*produceSet).wouldOverflow(0xc0004d1440, 0xc000576fa0) /go/pkg/mod/github.com/!shopify/sarama@v1.38.1/produce_set.go:249 +0x19d github.com/Shopify/sarama.(*brokerProducer).run(0xc0007e7ce0) /go/pkg/mod/github.com/!shopify/sarama@v1.38.1/async_producer.go:960 +0x63e github.com/Shopify/sarama.withRecover(0x0?) /go/pkg/mod/github.com/!shopify/sarama@v1.38.1/utils.go:43 +0x33 created by github.com/Shopify/sarama.(*asyncPreoducer).newBroker Producer in goroutine 190 /go/pkg/mod/github.com/!shopify/sarama@v1.38.1/async_producer.go:790 +0x225 ```

Additional Context
puellanivis commented 1 day ago

It’s unclear what the problem is, but a number of fixes have happened since 1.38.1. Have you tried upgrading to v1.43.3 already?