Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep-alive argument unrecognised #3325

Closed
jsabater opened this issue Nov 20, 2024 · 3 comments
Closed

keep-alive argument unrecognised #3325

jsabater opened this issue Nov 20, 2024 · 3 comments

Comments

@jsabater
Copy link

jsabater commented Nov 20, 2024

Good day! I am getting the following error when trying to use the --keep-alive argument in gunicorn 23.0:

gunicorn: error: unrecognized arguments: –-keepalive=60

This is the relevant excerpt from my /etc/systemd/system/gunicorn.service file:

[Service]
Type=notify
User=django
Group=django
RuntimeDirectory=gunicorn # ~/run/gunicorn
WorkingDirectory=/opt/django/src
PIDFile=/opt/django/run/gunicorn.pid
EnvironmentFile=/etc/environment
EnvironmentFile=/opt/django/src/settings.env
ExecStart=/opt/django/venv/bin/gunicorn myapp.wsgi \
  --bind=0.0.0.0:8080 \
  --pid=/opt/django/run/gunicorn.pid \
  --workers=5 \
  --worker-class=gthread \
  --worker-tmp-dir=/dev/shm \
  --threads=4 \
  --timeout=60 \
  --certfile=/etc/ssl/certs/domain.com.crt \
  --keyfile=/etc/ssl/private/domain.com.key \
  --error-logfile=/opt/django/logs/gunicorn.error.log \
  --access-logfile=/opt/django/logs/gunicorn.access.log \
  --access-logformat='%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %(L)s %(p)s %({x-request-id}i)s' \
  –-keep-alive=60

I don't know what I am doing wrong. I've checked the documentation and it does not say whether it can or cannot be used with some other arguments. Is this a bug of the software or am I using it the wrong way or in the wrong scenario?

Thanks in advance.

P.S. I am trying to increase the keepalive time to match that of the NGINX reverse proxy located downstream.

@sylt
Copy link

sylt commented Nov 20, 2024

Don't know if this is the issue, but it seems like the option –-keep-alive=60 in the file your posted doesn't actually have two leading --; the first character is some sort of long hyphen, and the second a normal dash. So, see if it works if you write --keep-alive=60 instead (i.e., with two leading "normal" dashes).

@pajod
Copy link
Contributor

pajod commented Nov 24, 2024

If you have copied that \N{EN DASH} (a typographic variant not used in argparse, Unicode 1.1 General Punctuation) from some documentation where it should have rendered as \N{HYPHEN-MINUS} (the one used for argparse, ASCII) - please report back where exactly. It is a common mistake caused by not marking literal options as such when generating sphinx docs. (I just confirmed a few issues like that in gunicorn docs, but not with that option.)

@jsabater
Copy link
Author

Okay, that was it. I was in my console, using a monospace font, and there was no visual difference. I deleted the spaces and the dashes and typed them manually. And it worked. Sorry for the hassle.

Regarding your request, I can only think of two places: the official documentation, which I already linked in my opening post. I am sorry I cannot be of help there.

Thanks for your time and help. I guess that, no matter how many years one has been doing this, there is always room for surprises, heh...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants