On Linux:
Three steps to diagnose Bind Failed Address Already In Use Issue.
Step-1 : Check the Process : netstat -tulpn or netstat -tulpn | grep port_no
[Port in question – 8000]
root@core3xdockers:~/godev/src/github.com/ev2xchaincodeservice# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14246/nginx -g daem
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 27537/sshd
tcp6 0 0 :::9051 :::* LISTEN 5964/docker-proxy
tcp6 0 0 :::9053 :::* LISTEN 5935/docker-proxy
tcp6 0 0 :::5984 :::* LISTEN 5614/docker-proxy
tcp6 0 0 :::8000 :::* LISTEN 2847/main
tcp6 0 0 :::10051 :::* LISTEN 6025/docker-proxy
tcp6 0 0 :::10053 :::* LISTEN 6007/docker-proxy
tcp6 0 0 :::6984 :::* LISTEN 5541/docker-proxy
tcp6 0 0 :::7050 :::* LISTEN 5415/docker-proxy
tcp6 0 0 :::7051 :::* LISTEN 6459/docker-proxy
tcp6 0 0 :::7053 :::* LISTEN 6436/docker-proxy
tcp6 0 0 :::7984 :::* LISTEN 5472/docker-proxy
tcp6 0 0 :::80 :::* LISTEN 14246/nginx -g daem
tcp6 0 0 :::8051 :::* LISTEN 6277/docker-proxy
tcp6 0 0 :::8053 :::* LISTEN 6256/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 27537/sshd
tcp6 0 0 :::8984 :::* LISTEN 5507/docker-proxy
Step-2 : Kill this Process
root@core3xdockers:~/godev/src/github.com/ev2xchaincodeservice# kill -9 6025
Step-3 : Verify the nestat table
root@core3xdockers:~/godev/src/github.com/ev2xchaincodeservice# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14246/nginx -g daem
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 27537/sshd
tcp6 0 0 :::9051 :::* LISTEN 5964/docker-proxy
tcp6 0 0 :::9053 :::* LISTEN 5935/docker-proxy
tcp6 0 0 :::5984 :::* LISTEN 5614/docker-proxy
tcp6 0 0 :::8000 :::* LISTEN 2847/main
tcp6 0 0 :::10053 :::* LISTEN 6007/docker-proxy
tcp6 0 0 :::6984 :::* LISTEN 5541/docker-proxy
tcp6 0 0 :::7050 :::* LISTEN 5415/docker-proxy
tcp6 0 0 :::7051 :::* LISTEN 6459/docker-proxy
tcp6 0 0 :::7053 :::* LISTEN 6436/docker-proxy
tcp6 0 0 :::7984 :::* LISTEN 5472/docker-proxy
tcp6 0 0 :::80 :::* LISTEN 14246/nginx -g daem
tcp6 0 0 :::8051 :::* LISTEN 6277/docker-proxy
tcp6 0 0 :::8053 :::* LISTEN 6256/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 27537/sshd
tcp6 0 0 :::8984 :::* LISTEN 5507/docker-proxy
root@core3xdockers:~/godev/src/github.com/ev2xchaincodeservice#
On Mac :
Step: 1:
London:~ esumit$ lsof -t -i :8000
13155
London:~ esumit$
Step: 2:
kill $(lsof -t -i :13155)