apache / cassandra-gocql-driver

GoCQL Driver for Apache Cassandra®
https://cassandra.apache.org/
Apache License 2.0
2.59k stars 621 forks source link

panic: Nil pointer dereference in HostInfo state #743

Closed balboah closed 8 years ago

balboah commented 8 years ago

When a Cassandra node crashed, so did gocql:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x8cf18e]
goroutine 22509977 [running]:
panic(0xd63920, 0xc820010060)
/usr/local/go/src/runtime/panic.go:464 +0x3e6
.../vendor/github.com/gocql/gocql.(*HostInfo).State(0x0, 0x0)
/go/src/.../vendor/github.com/gocql/gocql/host_source.go:188 +0x8e
.../vendor/github.com/gocql/gocql.(*HostInfo).IsUp(0x0, 0x0)
/go/src/.../vendor/github.com/gocql/gocql/host_source.go:237 +0x21
.../vendor/github.com/gocql/gocql.(*queryExecutor).executeQuery(0xc820166b00, 0x7fa2a99ff5a8, 0xc82a719400, 0x3, 0x0, 0x0)
/go/src/.../vendor/github.com/gocql/gocql/query_executor.go:27 +0xf5
.../vendor/github.com/gocql/gocql.(*Session).executeQuery(0xc8200b38c0, 0xc82a719400, 0xc82a719400)
/go/src/.../vendor/github.com/gocql/gocql/session.go:308 +0xf0
.../vendor/github.com/gocql/gocql.(*Query).Iter(0xc82a719400, 0x1002e80)
/go/src/.../vendor/github.com/gocql/gocql/session.go:853 +0xc9

GoCQL revision: 1440c6 Cassandra version: 2.1.13

Zariel commented 8 years ago

What host policy was in use?

balboah commented 8 years ago

@Zariel HostSelectionPolicy: gocql.TokenAwareHostPolicy(gocql.RoundRobinHostPolicy()),