Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader.Close hangs for ReaderConfig.MaxWait #428

Open
feldgendler opened this issue Apr 14, 2020 · 4 comments · May be fixed by #429 or #1347
Open

Reader.Close hangs for ReaderConfig.MaxWait #428

feldgendler opened this issue Apr 14, 2020 · 4 comments · May be fixed by #429 or #1347
Assignees

Comments

@feldgendler
Copy link

feldgendler commented Apr 14, 2020

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.

@Antonboom
Copy link

+1

@SuddenGunter
Copy link

had the same issue
any fix for it?

@rhasanoff
Copy link

Having the same issue +1

@Gewinum
Copy link

Gewinum commented Oct 26, 2024

i've got the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants