'Heroku Foreman errors on 0.0.0.0:5000
I am trying to debug this issue using Heroku's Foreman app. My issue is that Foreman is trying to run the process on port 5000 and at ip address 0.0.0.0. It says there is something using the port but I am not sure how to figure that out as I have nothing else running. I tried running 'netstat -lnt | grep 5000' with nothing.
> foreman start
11:16:45 web.1 | started with pid 17758
11:16:46 web.1 | 2013-12-31 11:16:46 [17758] [INFO] Starting gunicorn 18.0
11:16:46 web.1 | 2013-12-31 11:16:46 [17758] [ERROR] Connection in use: ('0.0.0.0', 5000)
11:16:46 web.1 | 2013-12-31 11:16:46 [17758] [ERROR] Retrying in 1 second.
11:16:47 web.1 | 2013-12-31 11:16:47 [17758] [ERROR] Connection in use: ('0.0.0.0', 5000)
11:16:47 web.1 | 2013-12-31 11:16:47 [17758] [ERROR] Retrying in 1 second.
I run the gunicorn command by it's self and it works fine (so I was able to eliminate that as an issue):
> gunicorn hellodjango.wsgi
2013-12-31 11:25:33 [17853] [INFO] Starting gunicorn 18.0
2013-12-31 11:25:33 [17853] [INFO] Listening at: http://127.0.0.1:8000 (17853)
2013-12-31 11:25:33 [17853] [INFO] Using worker: sync
2013-12-31 11:25:33 [17856] [INFO] Booting worker with pid: 17856
I am running this on my Mac (10.8).
Any insight on how to figure this out would be greatly appreciated.
-rb
Upon further investigation, I discovered that 0.0.0.0:5000 is used by Bonjour, Apple's network discovery app. Looking into how to change the port for Foreman next.
Solution 1:[1]
Figured this all out.
Solve is to manually set the port in the env and run foreman that way.
export PORT=5001
then
> foreman start
13:22:23 web.1 | started with pid 18194
13:22:24 web.1 | 2013-12-31 13:22:24 [18194] [INFO] Starting gunicorn 18.0
13:22:24 web.1 | 2013-12-31 13:22:24 [18194] [INFO] Listening at: http://0.0.0.0:5001 (18194)
13:22:24 web.1 | 2013-12-31 13:22:24 [18194] [INFO] Using worker: sync
13:22:24 web.1 | 2013-12-31 13:22:24 [18197] [INFO] Booting worker with pid: 18197
I imagine this will be an issue for everyone on OSX and hopefully this will save some headaches.
-rb
Solution 2:[2]
responding here as this page is the top listing on Google for 'Connection in use: ('0.0.0.0', 5000)'
The answer at Virtual env: Connection in use error worked perfectly for me:
you can find the id for unicorn to kill it via
ps ax|grep unicorn
and then using the id of the gunicorn instancekill <id>
Solution 3:[3]
I couldn't find a gunicorn process running to kill and none of the other suggestions worked for me so I tried restarting my Mac (OSX 10.9.2) with the "Reopen windows when logging back in" checkbox unchecked and after rebooting it started working again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | renderbox |
Solution 2 | |
Solution 3 | wizardbyte |