Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

netkwork/hive: addPeer function assigned after launching goroutine co… #1896

Conversation

kortatu
Copy link
Contributor

@kortatu kortatu commented Oct 22, 2019

At hive Start() we launch the loadPeers and inside it we launch the goroutine go h.connectInitialPeers(conns). After that addPeer is assigned, this resulted that in some test executions, the connection to the peers is done before the function is set.
We have moved the assign before the loadPeers call.

Previous error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb07f2d]

goroutine 31931 [running]:
github.com/ethersphere/swarm/network.(*Hive).connectInitialPeers(0xc00fa226e0, 0xc0148ed880, 0xd, 0xd)
    /home/rinke/go/src/github.com/ethersphere/swarm/network/hive.go:284 +0x5cd
created by github.com/ethersphere/swarm/network.(*Hive).loadPeers
    /home/rinke/go/src/github.com/ethersphere/swarm/network/hive.go:269 +0x59b
FAIL    github.com/ethersphere/swarm/network/simulations/discovery    14.576s

@acud acud merged commit d0d871c into ethersphere:master Oct 22, 2019
@kortatu kortatu deleted the bug-add-peer-added-after-loading-connections branch October 23, 2019 06:13
@acud acud added this to the 0.5.3 milestone Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants