Skip to content

使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host. #2771

Closed
@LiuYanJan

Description

@LiuYanJan

Issue tracker is used for reporting bugs and discussing new features. Please use
stackoverflow for supporting issues.

使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.

使用 rdb.Get() 报错 panic: read tcp 192.168.31.70:50126->192.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.
代码如下, DOMAIN_INFOS 中为字符串 约34000个字符
func opRedis(x [][]string) {
var ctx = context.Background()
rdb := redis.NewClient(&redis.Options{
Addr: "192.168.31.22:6379",
Password: "qwe@123456",
DB: 0, // use default DB
})

Scan_Status, err := rdb.Get(ctx, "ScanStatus").Result()
if err != nil {
	panic(err)
}

fmt.Println("ScanStatus: ", Scan_Status)
DOMAIN_INFOS, err := rdb.Get(ctx, "DOMAIN_INFOS").Result()
if err != nil {
	panic(err)
}
fmt.Println("DOMAIN_INFOS: ", DOMAIN_INFOS)

}

程序可以打印 ScanStatus
ScanStatus: 1
panic: read tcp 192.168.31.70:50126->92.168.31.22:6379: wsarecv: An existing connection was forcibly closed by the remote host.

goroutine 1 [running]:
main.opRedis({0xc0000c7f28, 0x3, 0x6?})
C:/GoProject/src/golearn/opredis/main.go:36 +0x547

这是什么原因造成的呢?或者我该如何取出这个值?
希望得到您的解答, 谢谢!!!

Steps to Reproduce

Context (Environment)

Detailed Description

Possible Implementation

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