Skip to content

panic in ring #2711

Closed
Closed
@krvladislav

Description

@krvladislav

Expected Behavior

No panic

Current Behavior

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc959b4] goroutine 3752565 [running]: github.com/redis/go-redis/v9.(*Ring).generalProcessPipeline.func1({0xffffe4caaa80?, 0x46f4c4?}, {0x407a79d8a0?, 0x2, 0x2}) /go/pkg/mod/github.com/redis/go-redis/v9@v9.0.2/ring.go:779 +0x2f4 created by github.com/redis/go-redis/v9.(*Ring).generalProcessPipeline /go/pkg/mod/github.com/redis/go-redis/v9@v9.0.2/ring.go:765 +0x240

Context (Environment)

Version: go-redis/v9@v9.0.2

Detailed Description

The application calls SetAddrs() in runtime actively so it's seems there is race condition.

Possible Implementation

Shards map can change in time duration between calculating c.sharding.Hash(hash) and getting a shard c.sharding.GetByName(hash). May be shard selection should be done in single mutex section

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