-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Hi,
Running uber-go/goleak, I found that this example
package main
import (
"fmt"
"testing"
"github.com/go-redis/redis"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
func TestGoRedisLeak(t *testing.T) {
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
DB: 0,
})
defer client.Close()
pong, err := client.Ping().Result()
fmt.Println(pong, err)
}seems to leak goroutines. I get the following message from uber-go/goleak:
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 36 in state chan receive, with github.com/go-redis/redis/internal/pool.(*ConnPool).reaper on top of the stack:
goroutine 36 [chan receive]:
github.com/go-redis/redis/internal/pool.(*ConnPool).reaper(0xc0000c0580, 0xdf8475800)
/home/vthiery/go/pkg/mod/github.com/go-redis/redis@v6.15.2+incompatible/internal/pool/pool.go:449 +0xb4
created by github.com/go-redis/redis/internal/pool.NewConnPool
/home/vthiery/go/pkg/mod/github.com/go-redis/redis@v6.15.2+incompatible/internal/pool/pool.go:99 +0x2d3
]
Am I doing something wrong here? or misunderstand what's happening?
Metadata
Metadata
Assignees
Labels
No labels