kafka-go
kafka-go copied to clipboard
Reader.Close hangs for ReaderConfig.MaxWait
Describe the bug
After reading once, Reader.Close
hangs until the end of a MaxWait
duration.
Kafka Version 2.3.0
To Reproduce
package main
import (
"context"
"fmt"
"time"
"github.com/segmentio/kafka-go"
)
func main() {
reader := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092"}, // assuming a running Kafka instance
Topic: "test", // does not need to exist
MaxWait: time.Hour,
})
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
fmt.Println("Trying to read...")
_, _ = reader.FetchMessage(ctx)
fmt.Println("Closing reader...")
reader.Close()
fmt.Println("Test passed")
}
Expected behavior
Reader.Close
should close the connection and return immediately.
+1
had the same issue any fix for it?
Having the same issue +1