Skip to content

Context cancel not working on blocking operations in v9 #2556

Open
@FLAGLORD

Description

@FLAGLORD

I noticed the #1196 (comment), and it seems that maintainers have fixed this.

But i use the alomost the same code given in the #1196 (comment):

client := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",
	})

cancelCtx, cancelFn := context.WithCancel(context.Background())

wg := &sync.WaitGroup{}
wg.Add(1)

go func() {
	client.BRPop(cancelCtx, 0, "")
	wg.Done()
}()

time.Sleep(2 * time.Second)

cancelFn()
wg.Wait()

It still waits indefinitely due to the 0 timeout. I have no idea...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions