Skip to content

nil dereference in singleConnPool #135

Closed
@abustany

Description

Using 2cfe5df , we do get the following panic (I replaced the workspace path by XXX):

[signal 0xb code=0x1 addr=0x50 pc=0x652f55]
goroutine 1657784 [running]:
gopkg.in/redis%2ev3.(*singleConnPool).remove(0xc209555500, 0x0, 0x0)
    XXX/src/gopkg.in/redis.v3/pool.go:396 +0x55
gopkg.in/redis%2ev3.(*singleConnPool).Remove(0xc209555500, 0xc20a3217a0, 0x0, 0x0)
    XXX/src/gopkg.in/redis.v3/pool.go:392 +0x168
gopkg.in/redis%2ev3.(*baseClient).putConn(0xc2087b7640, 0xc20a3217a0, 0x7ff04bdbc050, 0xc20bc2b400)
    XXX/src/gopkg.in/redis.v3/redis.go:32 +0x250
gopkg.in/redis%2ev3.(*baseClient).process(0xc2087b7640, 0x7ff04bda98e0, 0xc2098a6230)
    XXX/src/gopkg.in/redis.v3/redis.go:73 +0x2cc
gopkg.in/redis%2ev3.*baseClient.(gopkg.in/redis%2ev3.process)·fm(0x7ff04bda98e0, 0xc2098a6230)
    XXX/src/gopkg.in/redis.v3/redis.go:185 +0x3b
gopkg.in/redis%2ev3.(*commandable).Process(0xc2091ee808, 0x7ff04bda98e0, 0xc2098a6230)
    XXX/src/gopkg.in/redis.v3/commands.go:30 +0x3b
gopkg.in/redis%2ev3.(*commandable).Select(0xc2091ee808, 0x22a, 0xc209555500)
    XXX/src/gopkg.in/redis.v3/commands.go:84 +0x11d
gopkg.in/redis%2ev3.(*conn).init(0xc20a3217a0, 0xc208162180, 0x0, 0x0)
    XXX/src/gopkg.in/redis.v3/conn.go:59 +0x225
gopkg.in/redis%2ev3.func·001(0xc208131c60, 0x0, 0x0)
    XXX/src/gopkg.in/redis.v3/conn.go:36 +0x1fb
gopkg.in/redis%2ev3.(*connPool).new(0xc2086325c0, 0x0, 0x0, 0x0)
    XXX/src/gopkg.in/redis.v3/pool.go:205 +0x169

This was with a Redis instance that was melting down (latencies above 5 seconds), and options.ReadTimeout == options.WriteTimeout == 5 * time.Second.

We do use many databases on this server, so my guess is that the Select() in conn.init failed, and lead to the connection being closed. Because the singleConnPool in cn.init is created with a nil pool, remove() does a nil dereference.

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