cluster: Fix index out of range in removeNodesCopy #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ran into some issues where we would get an index out of range because
make() was given a length of zero.
Thus the first time nodeArray is accessed it threw an index out
of range panic.
It was only happening a few seconds after starting the cluster, so
there might be a bit more of an elegant solution but I have not had
time to take a deeper look into it.
Most recent stacktrace (using an older version of the library):
panic: runtime error: index out of range
goroutine 71 [running]:
github.com/aerospike/aerospike-client-go.(_Cluster).removeNodesCopy(0xc208
7d4080, 0xc2d2a6cee8, 0x1, 0x1)
/usr/go/src/github.com/aerospike/aerospike-client-go/cluster.go:528 +0x54d
github.com/aerospike/aerospike-client-go.(_Cluster).removeNodes(0xc2087d40
80, 0xc2d2a6cee8, 0x1, 0x1)
/usr/go/src/github.com/aerospike/aerospike-client-go/cluster.go:504 +0x256
github.com/aerospike/aerospike-client-go.(_Cluster).tend(0xc2087d4080, 0x0,
0x0)
/usr/go/src/github.com/aerospike/aerospike-client-go/cluster.go:187 +0x413
github.com/aerospike/aerospike-client-go.(_Cluster).clusterBoss(0xc2087d4080)
/usr/go/src/github.com/aerospike/aerospike-client-go/cluster.go:110 +0x206
created by github.com/aerospike/aerospike-client-go.NewCluster
/usr/go/src/github.com/aerospike/aerospike-client-go/cluster.go:91 +0x3fd