-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
panic in net/swarm/conn.go:154 was triggered #174
Comments
Logs leading up to the panic: �[31m2014-10-14 11:22:51.523365 dht.go:323 ERROR: �[0mgetFromPeers error: Error: Connection to this peer already open. |
This appears to be caused by two different peers trying to connect to eachother at the same time as a result of everyone trying to get the same value. |
Found. It. This was annoying. Took me way too long. And i got rid of it for a long time, but then resurfaced. Turns out the problem was a bad combination of Dial + Listen. (a peer would dial out and receive a connection from the same peer at the same time, ending with two Peer objectS). I got rid of it in the codebase, but surfaced in the tests, then fixed it. // Dial connects to a particular peer, over a given network
// Example: d.Dial(ctx, "udp", peer)
func (d *Dialer) Dial(ctx context.Context, network string, remote peer.Peer) (Conn, error) {
laddr := d.LocalPeer.NetAddress(network)
if laddr == nil {
return nil, fmt.Errorf("No local address for network %s", network)
}
raddr := remote.NetAddress(network)
if raddr == nil {
return nil, fmt.Errorf("No remote address for network %s", network)
}
// TODO: try to get reusing addr/ports to work.
// madialer := manet.Dialer{LocalAddr: laddr}
madialer := manet.Dialer{}
log.Info("%s dialing %s %s", d.LocalPeer, remote, raddr)
maconn, err := madialer.Dial(raddr)
if err != nil {
return nil, err
}
// THIS. remote here is the value the function was called with. but after waiting
// on madialer.Dial, a new peer might have been added to Peerstore by Listen
if err := d.Peerstore.Put(remote); err != nil {
log.Error("Error putting peer into peerstore: %s", remote)
}
c, err := newSingleConn(ctx, d.LocalPeer, remote, maconn)
if err != nil {
return nil, err
}
return newSecureConn(ctx, c, d.Peerstore)
} |
Changed lots of peer use, and changed the peerstore to ensure there is only ever one peer in use. Fixed ipfs#174
Implement SearchValue
Was running a dhtHell test (albeit a larger one) and came across this panic.
dhtHell config:
The text was updated successfully, but these errors were encountered: