registry: [gossip] fix panic
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0xd1b215] goroutine 8 [running]: sync.(*RWMutex).RLock(...) /var/home/vtolstov/sdk/go1.12beta2/src/sync/rwmutex.go:48 github.com/hashicorp/memberlist.(*Memberlist).LocalNode(0x0, 0x0) /home/vtolstov/devel/projects/centralv2/vendor/github.com/hashicorp/memberlist/memberlist.go:417 +0x35 github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run.func3(0xc000155880) /home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:565 +0xf5 created by github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run /home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:553 +0xa25 Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
0cdae40f04
commit
f961c571bd
@ -561,11 +561,13 @@ func (g *gossipRegistry) run() {
|
|||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
var addrs []string
|
var addrs []string
|
||||||
g.RLock()
|
g.RLock()
|
||||||
|
if g.member != nil {
|
||||||
for node, action := range g.members {
|
for node, action := range g.members {
|
||||||
if action == nodeActionLeave && g.member.LocalNode().Address() != node {
|
if action == nodeActionLeave && g.member.LocalNode().Address() != node {
|
||||||
addrs = append(addrs, node)
|
addrs = append(addrs, node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
g.RUnlock()
|
g.RUnlock()
|
||||||
if len(addrs) > 0 {
|
if len(addrs) > 0 {
|
||||||
g.connect(addrs)
|
g.connect(addrs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user