go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

Sentinel with PubSub deadlocks on Close

Open danilobuerger opened this issue 3 months ago • 0 comments

When using the FailoverClient (Sentinel) with PubSub, calling Close will deadlock.

Expected Behavior

Close will close the PubSub and return.

Current Behavior

Close does not return.

Steps to Reproduce

func main() {
	client := redis.NewFailoverClient(&redis.FailoverOptions{
		MasterName:    "...",
		SentinelAddrs: []string{"..."},
	})

	pubSub := client.Subscribe(context.Background())
	pubSub.Channel()
	time.Sleep(1 * time.Second)
	log.Println("Subscribed")

	pubSub.Close()
	log.Println("Closed")
}

Version: 9.5.1

danilobuerger avatar Mar 20 '24 22:03 danilobuerger