Open ryanberckmans opened 5 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Im having the same issue.
Geth
Version: 1.9.10-stable
Git Commit: 58cf5686eab9019cc01e202e846a6bbc70a3301d
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.13.7
Operating System: darwin (OSX 10.15.2)
I built with
make geth
Ran geth with
build/bin/geth console
typed exit to close geth
exit
waited a few seconds to restart the node and got
Fatal: Error starting protocol stack: listen udp [::]:30303: bind: address already in use
Process doesn't appear anywhere. I can force it to start by either changing the --port flag or restarting my machine.
First reporter:
Operating System: darwin (OSX 10.13.6)
Second reporter:
Operating System: darwin (OSX 10.15.2)
Might be something with OSX?
I could not reproduce the error with either of the situations documented on this issue.
My system info:
Geth
Version: 1.9.14-unstable
Git Commit: 3bf1054a13f2ed2ba8c0c7c44279bbca6e4e7cbb
Git Commit Date: 20200416
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.14.1
Operating System: darwin (OSX 10.15.4)
GOPATH=
GOROOT=/usr/local/Cellar/go/1.14.1/libexec
This happens when the macOS firewall is enabled. We cannot fix this issue, but we could work around it by using a random, OS-assigned port by default.
I have worked around this this way which is admittedly nuts. Remove the ethernet cable, wait for sockets to drain. shutdown. I have never had this fail although I may just have been lucky. This a decades old bug in OSX. My theory is an apparently closed udp socket with data waiting to be read and the firewall is in use doesn't always get cleaned up. Never found a way to free the socket but I imagine a source code guru could use a debugger to clear the network stack that has that data, maybe without a crash.
System information
Expected behaviour
Discovery UDP listener should close socket on shutdown/interrupt in all cases.
Actual behaviour
In certain code paths, the discovery UDP listener is not closed on shutdown/interrupt, preventing geth from restarting until the port is manually released or system restarted.
I hit one of these code paths but don't have a specific repro.
Invocation that produced dangling UDP listener (light node):
Listener initialization which became dangling:
Interrupt which failed to close UDP listener:
Fatal when attempting to restart geth:
Util showing port not released:
Confirm pid
45852
doesn't exist (ie. port is unreleased after process killed; not unkilled/zombie process)