Error with gunicorn server start
Asked Answered
T

3

15

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?

Tenedos answered 29/1, 2017 at 15:15 Comment(0)
C
8

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)

Campanology answered 29/1, 2017 at 16:16 Comment(0)
T
18

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
Toadinthehole answered 19/7, 2018 at 21:35 Comment(0)
C
8

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)

Campanology answered 29/1, 2017 at 16:16 Comment(0)
M
7

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.

Mathers answered 5/1, 2021 at 11:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.