VIDA-NYU / domain_discovery_tool_deprecated

Seed acquisition tool to bootstrap focused crawlers
23 stars 8 forks source link

Bind for 0.0.0.0:8084 failed: port is already allocated #73

Closed mikew77 closed 8 years ago

mikew77 commented 8 years ago

Whilst trying to restart the docker deployment of DDT I get the "port is already allocated" message.

I check iptables and had the following entries - and tried to remove the 8084 nat entry manually and recreate the images but got the same error.

I resolved this by removing the docker images and then removing the domain_discovery_tool directory, creating a new clone and rebuilding.

~/domain_discovery_tool$ sudo iptables -t nat -L -n --line-numbers Chain PREROUTING (policy ACCEPT) num target prot opt source destination
1 DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT) num target prot opt source destination

Chain OUTPUT (policy ACCEPT) num target prot opt source destination
1 DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT) num target prot opt source destination
1 MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0
2 MASQUERADE tcp -- 172.17.0.1 172.17.0.1 tcp dpt:8084 3 MASQUERADE tcp -- 172.17.0.1 172.17.0.1 tcp dpt:9200

Chain DOCKER (2 references) num target prot opt source destination
1 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8084 to:172.17.0.1:8084 2 DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:9200 to:172.17.0.1:9200

sudo iptables -D DOCKER 1 -t nat

canavandl commented 8 years ago

It appears that force killing the web application (via Ctrl + C) or when the application crashes due to an internal exception, it will sometimes orphan the python process instead of killing it. The orphan process can be identified via:

$ netstat -anp | grep 8084
> tcp    0     0  0.0.0.0:8084    0.0.0.0:*    LISTEN
  3497/python

You can kill the process via it's pid:

kill -9 3497
mikew77 commented 8 years ago

This is great thanks @canavandl; a lot easier thank a rebuild :+1: