Skip to content

[Triage] [uwsgi] InvalidUWSGIHeader: incomplete header when using gevent or gthread workers #3552

@benoitc

Description

@benoitc

Discussed in #3539

Originally posted by Jean-Daniel March 4, 2026

Type

Bug Report

Description

When deploying a Django app in production with nginx and uwsgi_pass, I got a lot of errors from gunicorn like this one:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.14/site-packages/gunicorn/workers/base_async.py", line 61, in handle
    req = next(parser)
  File "/app/.venv/lib/python3.14/site-packages/gunicorn/http/parser.py", line 56, in __next__
    self.mesg = self.mesg_class(self.cfg, self.unreader, self.source_addr, self.req_count)
                ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.14/site-packages/gunicorn/uwsgi/message.py", line 68, in __init__
    unused = self.parse(self.unreader)
  File "/app/.venv/lib/python3.14/site-packages/gunicorn/uwsgi/message.py", line 96, in parse
    raise InvalidUWSGIHeader("incomplete header")
gunicorn.uwsgi.errors.InvalidUWSGIHeader: Invalid uWSGI header: incomplete header

[5] [ERROR] Error handling request (no URI read)

When switching to sync worker mode, there is no error, but this is not an acceptable workaround for a production server.

It may be related to #3207 but this is not the exact same issue, as it does not involve timeout and is when using uwsgi.

Steps to Reproduce (for bugs)

Create a simple app
Deploy behind nginx with mod_uwsgi
Run using gunicorn gevent worker
Make some requests to nginx.

Configuration

protocol = "uwsgi"

workers = 2
worker_class = "gevent"
worker_connections = 512

Logs / Error Output

No response

Gunicorn Version

gunicorn 25.1.0

Python Version

Python 3.14

Worker Class

gevent

Operating System

python:3.14-slim docker image

Additional Context

No response

Checklist

  • I have searched existing discussions and issues for duplicates
  • I have checked the documentation and FAQ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions