Reputation:
On an external server, I tried to run the command:
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
I got this error:
[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:07 +0000] [19640] [ERROR] Can't connect to ('0.0.0.0', 8000)
What can I do to fix this issue?
Upvotes: 17
Views: 43192
Reputation: 71
This worked for me:
pgrep gunicorn
It will return you the pid, something like this:
23716
23718
Now kill any one of them (or all) using:
kill 23716
You can recheck using pgrep gunicorn
if it's still running.
Upvotes: 7
Reputation: 1614
I got the same error but all I do is kill my port 8000 from this command.
sudo fuser -k 8000/tcp
Now you can run the command
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
Upvotes: 19
Reputation: 49774
The error message:
Connection in use: ('0.0.0.0', 8000)
Indicates the port is in use. You need to find whoever is currently using the port and turn them off. If you can sudo
, you can use netstat
to find who is already using the port:
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/gunicorn
In the example above it is guincorn
with a pid of 125004
.
(Source)
Upvotes: 8