Skip to content
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

Restart fails: UDP socket reuse #389

Closed
ebuchman opened this issue Nov 28, 2014 · 2 comments
Closed

Restart fails: UDP socket reuse #389

ebuchman opened this issue Nov 28, 2014 · 2 comments

Comments

@ebuchman
Copy link
Contributor

I'm writing a little wrapper to make it easier to use ipfs as a library.

I've been having trouble restarting the node due to socket reuse problems with the utp socket. I noticed the SO_REUSE opts commented out in net/swarm/conn.go, but it seems to have no problem reusing the TCP connection, so I'm especially surprised there's a problem reusing the UDP. I have confirmed the socket indeed remains open while the TCP connection is closed (using lsof -i) even after the log (below) indicates it's been closed.

21:35:04.003  INFO       conn: listener closing: [Peer Qme5epCPhcKA] /ip4/0.0.0.0/tcp/4001 listen.go:47
21:35:04.003 DEBUG       conn: [Peer Qme5epCPhcKA] closing Conn with [Peer QmaCpDMGvV2B] multiconn.go:216
21:35:04.003  INFO       conn: listener closing: [Peer Qme5epCPhcKA] /ip4/0.0.0.0/udp/4002/utp listen.go:47
21:35:04.003 DEBUG       conn: [Peer Qme5epCPhcKA] closing Conn with [Peer QmaCpDMGvV2B] conn.go:115
2014/11/27 21:35:09 restarting...
21:35:09.753  INFO      swarm: InterfaceListenAddresses:[/ip6/fe80::4e8d:79ff:fedb:fd72/tcp/4001 /ip4/192.168.1.140/tcp/4001] addrs.go:64
21:35:09.753  INFO      swarm: InterfaceListenAddresses:[/ip6/fe80::4e8d:79ff:fedb:fd72/udp/4002/utp /ip4/192.168.1.140/udp/4002/utp] addrs.go:64
21:35:09.753 ERROR      swarm: Failed to listen on: /ip4/0.0.0.0/udp/4002/utp - Failed to listen on /ip4/0.0.0.0/udp/4002/utp: listen udp 0.0.0.0:4002: bind: address already in use conn.go:28
21:35:09.753  INFO       conn: swarm listening on /ip4/0.0.0.0/tcp/4001 -- &{0xc20803c070 0xc208206d80}
 listen.go:78
2014/11/27 21:35:09 1: Failed to listen on /ip4/0.0.0.0/udp/4002/utp: listen udp 0.0.0.0:4002: bind: address already in use
@jbenet
Copy link
Member

jbenet commented Dec 5, 2014

Oh, this is interesting. thanks for finding this. It's possible this is due to how the utp lib works. I'll take a look at this in the next few days. cc @anacrolix as he may be interested.

@jbenet
Copy link
Member

jbenet commented Jan 5, 2015

@ebuchman i imagine this is a bug in h2so5/utp or jbenet/go-multiaddr-net. it shouldn't be in master as of #490 (merging shortly). Depending on what other udp transport we use (#58), this may or may not resurce. closing for now.

@jbenet jbenet closed this as completed Jan 5, 2015
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this issue Oct 23, 2021
fixes ipfs#389

Credit goes to @sidenaio for finding this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants