Skip to content

client hangs when non-blocking XREAD on empty streams  #1941

@fizx

Description

@fizx

Expected Behavior

Client should return an empty response.

Current Behavior

Client blocks forever, even with timeouts set..

Possible Solution

Will investigate.

Steps to Reproduce

package main

import (
	"context"
	"time"

	"github.com/go-redis/redis/v8"
)

func main() {
	re := redis.NewClient(&redis.Options{
		Addr:         "localhost:6379",
		ReadTimeout:  1 * time.Second,
		WriteTimeout: 1 * time.Second,
		MaxRetries:   0,
		PoolSize:     10,
		PoolTimeout:  1 * time.Second,
		DialTimeout:  1 * time.Second,
	})
	println("connected")
	read := re.XRead(context.Background(), &redis.XReadArgs{
		Streams: []string{"hi", "0"},
	})
	println("unreachable")
	println(read.Val())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions