pypi / gunicorn
gunicorn
What changed in gunicorn 24 to 27, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
50 breaking9 security1 deprecations34 new APIs and options7 performance16 behavior and defaults75 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initgunicorn 2763 changes
Breaking changes 27
ASGI responses never exceed the app's Content-Length, and the connection closes if the body is shorter.
Error responses use the standard reason phrase in the status line and put error text in the body.
The connection closes when an ASGI app returns before finishing its response.
Gunicorn stops when the app reports a failed lifespan startup instead of serving requests or repeatedly rebooting the worker.
Each request gets a shallow copy of lifespan state, so one request's scope state values are not seen by the next.
Requests rejected by the fast parser receive 400 and the connection closes, rather than being dropped without a response.
Usual request limits apply before unterminated lines finish, and trailers count against limit_request_fields.
Invalid ASGI response header names and values are rejected.
A line terminated by bare LF is rejected immediately with 400 rather than waiting for a limit or timeout.
The connection closes after a CONNECT request regardless of the application response; subsequent bytes are not served as another request.
Content-Length values that are not plain digits are rejected.
Dirty app stream reads are bounded by idle and total timeouts and drop the connection when either fires; sync streams no longer replace idle timeout with a fixed 5 seconds.
The fast extra requires gunicorn_h1c 0.6.14, which parses requests faster and matches Python parser acceptance and rejection across read splits.
Requests with whitespace between a header name and its colon are rejected.
HTTP/2 connections close with ENHANCE_YOUR_CALM when a peer sends more than 1000 PING, SETTINGS, or empty DATA frames in 10 seconds.
HTTP/2 sync workers close connections when more than 10000 frames pile up while a response waits for window credit.
Request paths containing raw non-ASCII bytes are rejected; such bytes must be percent-encoded.
Control characters and raw non-ASCII bytes in request paths are rejected; non-ASCII bytes must be percent-encoded.
Request paths containing control characters are rejected.
Requests whose Transfer-Encoding does not end in chunked are rejected with 400; clients must stop sending Transfer-Encoding: identity.
Control frames over 125 bytes or fragmented are rejected with close code 1002.
WebSockets reject malformed or forbidden frames, invalid UTF-8 text or close reasons, and answer an empty client close with 1000.
WebSocket handshakes require version 13 and a key that is 16 bytes of base64, returning 426 or 400 respectively when invalid.
An ASGI WebSocket handshake the app closes or never accepts returns HTTP 403, or 500 if the app raised, rather than a close frame.
ASGI delivers websocket.disconnect as soon as the client closes the connection.
WSGI returns 500 instead of 400 for an invalid application response header and omits the header value from the error.
WSGI rejects response statuses that are not three digits followed by a valid reason phrase.
Security 6
Malformed chunk extensions, including control characters and unclosed quotes, are rejected.
Content-Length values that are not plain digits are rejected.
The dirty arbiter creates its PID file in the temporary directory with mode 0600 and ignores files it did not create for processes that are not ours.
ASGI applies forwarded_allow_ips to HTTP/1 requests; forwarded headers affect the scheme only from trusted proxies.
ASGI applies forwarded-header trust settings to HTTP/1 requests; secure_scheme_headers are honored only from trusted proxies, and underscore header names follow header_map.
Gunicorn no longer calls listen() again on an already-listening socket, avoiding SELinux denials.
New APIs and options 1
Adds a WebSocket message-size setting, defaulting to 16 MiB; oversized messages close with 1009, while invalid control frames close with 1002.
Performance 4
ASGI reduces per-request work and copying; small requests and streamed responses are faster, and large responses use less memory under load.
Chunked request bodies are read in larger steps, up to the size each chunk announces.
Known-length request bodies are read in larger steps, speeding up large uploads, especially while other threads keep the worker busy.
Repeated request headers are joined in linear rather than quadratic time when building the WSGI environ.
Behavior and default changes 6
On a kept-alive HTTP/1.1 connection, the next request is served as soon as the previous response completes, without waiting for the application to return.
When a worker stops, kept-alive connections remain open for up to 2 seconds; requests arriving on them are answered with Connection: close instead of being dropped.
ASGI pauses socket reads while more than 256 KiB of request body or pipelined data waits for the application, then resumes as it reads.
ASGI pauses socket reads while unread WebSocket data or messages pile up, until the app catches up.
ASGI sends 100 Continue when the app first reads the body, avoiding client delays before uploads.
WebSocket sends wait while the client is not reading, preventing slow clients from growing the worker's write buffer.
Fixes and other changes 19
An informational (1xx) response sent after the final response has started is refused instead of being written out of order.
ASGI accepts whitespace between a chunk size and its extension, matching WSGI behavior.
ASGI error responses use standard reason phrases in the status line and put error text in the body.
ASGI reads the body declared by a HEAD request instead of treating it as the next request.
ASGI copies bytearray and memoryview response bodies when sending so later app buffer reuse cannot change the transmitted bytes.
ASGI returns 501 for unsupported transfer codings, matching WSGI behavior.
Chunk data not followed by CRLF is rejected.
ASGI accepts whitespace between a chunk size and its extension; malformed chunk extensions are rejected.
One empty line before the request line is ignored.
Idle gthread keep-alive connections no longer hold up graceful shutdown, and workers continue reporting while waiting during max_requests restarts.
A request arriving while the previous request's unread body is drained is served instead of waiting for the keepalive timeout.
The inotify reloader now reloads when the target of a symlinked file changes.
ASGI closes idle kept-alive connections after the configured keepalive seconds.
A request line over limit_request_line now receives 414 URI Too Long.
The connection closes when reading a request body fails, preventing bytes after the body from being lost on a reused connection.
On platforms without SO_REUSEPORT, workers use the master's sockets rather than failing to bind.
StatsD metrics are sent over IPv6 when statsd_host is a numeric IPv6 address.
Only spaces and tabs are trimmed around Transfer-Encoding values.
WebSocket send() after closure raises an OSError subclass that remains a RuntimeError; Gunicorn no longer logs it as an error.
gunicorn 2657 changes
Breaking changes 16
HTTP/2 request bodies stream to the application instead of being fully buffered; at most the receive window remains in flight.
HTTP/2 workers close RST_STREAM floods with ENHANCE_YOUR_CALM.
Waiting for HTTP/2 send credit is bounded by timeout.
HTTP/2 requests now share the HTTP/1 policy for header validation, duplicate headers, and forwarded_allow_ips trust; wsgi.url_scheme comes from the transport.
WSGI responses over HTTP/2 stream instead of being buffered whole before sending.
asyncio.CancelledError now propagates from BodyReceiver instead of being swallowed and returned as http.disconnect.
Truncated chunked bodies missing the mandatory empty trailer section are now rejected with ChunkMissingTerminator.
Dependency floors were raised for tornado, h2, setuptools, and pymdown-extensions; pytest and httpx now have floors to avoid versions permitted by the previous requirements.
When a request times out, the worker connection is closed so a late response cannot be returned for a later request.
Requests containing duplicate Host or Content-Type headers are now rejected with InvalidHeader by both parsers.
packaging is no longer a runtime dependency and moved to the gevent and testing extras, so a plain gunicorn install does not pull it in.
The eventlet worker class was removed; migrate to gevent, gthread, or tornado.
The fast HTTP parser now requires gunicorn_h1c >= 0.6.5.
Rejects authority-form targets outside CONNECT, asterisk-form targets outside OPTIONS, and relative-reference request-targets.
Rejects control characters in header values, forbidden trailer field-names, and Content-Length list form.
The ASGI PROXY Protocol callback parser now enforces proxy_allow_ips and tightens v1/v2 parsing.
Security 3
An unterminated chunk-size line or trailer section is bounded by existing request limits and scanned incrementally.
Connections are drained on close to prevent reset-on-close truncation.
Tightens the keepalive gate and finish_body byte cap, and keeps the body receiver alive across the gate to prevent pipelined requests from re-entering a closed body.
New APIs and options 1
Adds cleartext HTTP/2 modes for prior knowledge, HTTP/1.1 upgrade, both, or off. Supported by gthread, gevent, and asgi workers; only peers in forwarded_allow_ips are considered.
Performance 1
The C extension is now used wherever available on CPython; PyPy continues to use the Python parser.
Behavior and default changes 2
SIGHUP now applies changed logger settings while preserving process identity and listeners; invalid settings restore the previous working configuration.
Entries containing glob characters are re-expanded on every reload check, including recursive ** patterns; unmatched patterns warn instead of failing.
Fixes and other changes 34
The ASGI worker now sends Connection: close on HTTP/1.1 responses when it will not reuse the connection, preventing clients from treating a closed socket as persistent.
A reader paused under backpressure is resumed.
The ASGI worker no longer drops requests pipelined on kept-alive connections.
A bad request resets its own stream rather than the connection.
An empty final chunk now ends the HTTP/2 stream.
Graceful GOAWAY is honoured wherever it lands in the HTTP/2 workers.
An application error after headers have been sent resets the stream instead of corrupting the HPACK table.
Malformed chunked request bodies receive 400 Bad Request instead of raising.
Calling receive() after the body blocks until the peer disconnects instead of spinning the loop.
The uWSGI protocol works behind nginx uwsgi_pass again instead of returning 502 for every request.
A worker timeout no longer writes a 500 response onto a response body that has already started.
On the ASGI worker with the fast parser, requests carrying an Upgrade header no longer reach the application with an empty body.
Events read while blocked on a flow-control window are no longer discarded, preventing lost requests and body data.
HEAD, 204, and 304 responses no longer carry a body over HTTP/2.
sendfile() is refused on HTTP/2 responses rather than bypassing HTTP/2 framing.
Server-initiated closes now decrement the connection count and run cleanup exactly once, avoiding unnecessary graceful shutdown waits and warnings.
SIGHUP reloads no longer leak a control thread, selector file descriptor, and Unix socket per worker.
The dirty arbiter is reaped and reported correctly on SIGCHLD, including if it exits during worker reaping.
Cwd-relative extra files such as .env are watched through the current directory instead of raising InotifyError.
No-body responses warn about dropped file bytes only when there are bytes to drop.
The trace hook no longer crashes on dynamically generated code without a __file__.
Zero-valued gauges, counters, histograms, and timers are now reported; only None is skipped.
Unknown child processes are reaped silently at debug level, and only real workers can halt the server.
The WSGI path strips Content-Length on 1xx and 204 responses, drops bodies for no-body responses in write() and sendfile(), and logs one warning per request.
Fixes ASGI disconnect handling for Django-style apps.
Fixes duplicate Transfer-Encoding headers for BlackSheep streaming.
The callback now validates headers like process_headers and passes only the header name to InvalidHeader.
Interim 100-Continue responses no longer receive Transfer-Encoding: chunked.
The async HTTP/2 handler now marks the body complete when a stream ends so request bodies finalize correctly.
Preserves Content-Length on HEAD and 304 responses, drops body framing on HEAD/204/304 even when set by the framework, and warns once when an ASGI app emits a body for a no-body response.
Uses raw ASGI receive for Litestar request bodies and headers.
Normalizes keys to lowercase for the Quart headers endpoint.
Fixes binary sends when the text key is None.
Complies with the close-handshake state machine and closes the transport after the handshake completes.
gunicorn 2554 changes
Breaking changes 3
Adds checks that reject duplicate Content-Length headers, conflicting Content-Length and Transfer-Encoding, invalid HTTP/1.0 or stacked chunked encoding, invalid Transfer-Encoding values, and invalid chunk sizes.
Updates the Docker images to use Python 3.14.
The fast HTTP parser is available for WSGI and ASGI workers and requires gunicorn_h1c >= 0.4.1.
Deprecations 1
The eventlet worker is deprecated and will be removed in Gunicorn 26.0; migrate to gevent, gthread, or another supported worker type.
New APIs and options 27
Adds PROXY protocol v1 and v2 support to the callback parser.
Adds a setting for the control interface socket mode.
Adds a setting for the control interface's Unix socket.
Adds an in-memory key-value store shared by all workers, with get, set, delete, clear, keys, and has operations.
Adds an interactive control interface for managing running Gunicorn instances, including worker management and server control.
Adds an option to disable the control socket.
Adds a setting for configuring the app used by Dirty Arbiters.
A separate process pool executes long-running, blocking operations without blocking HTTP workers; its workers are asyncio-based and stateful.
Adds a graceful-timeout setting for Dirty Arbiters.
Adds a setting for configuring Dirty Arbiter threads.
Adds a timeout setting for Dirty Arbiters.
Adds a lifecycle hook for Dirty Arbiter workers.
Adds a setting for configuring the number of Dirty Arbiter workers.
Set the DirtyApp workers class attribute to control how many dirty workers load each app, enabling memory optimization.
Adds an exception for graceful handling when no workers are available for an app.
Install the http2 extra to add the h2 library required for HTTP/2 support.
Adds beta native HTTP/2 support with multiplexed streams, HPACK header compression, flow control, and stream prioritization; requires SSL/TLS and the h2 library.
Adds a setting for configuring supported HTTP protocols.
Adds an ASGI message type for sending HTTP 103 Early Hints.
Adds a setting for the initial HTTP/2 window size.
Adds a setting for the maximum number of concurrent HTTP/2 streams.
Adds a setting for the maximum HTTP/2 frame size.
Adds a setting for the maximum HTTP/2 header list size.
Configure per-app dirty worker allocation using the module:class:N format.
Adds a lifecycle hook for Dirty Arbiters.
The ASGI worker can receive requests via the uWSGI binary protocol from nginx.
Adds a WSGI callback for sending HTTP 103 Early Hints headers, allowing browsers to preload resources before the final response.
Performance 2
ASGI worker HTTP parsing is optimized with callback-based parsing, direct bytearray operations, and index-based header iteration.
Uses TLV encoding for dirty arbiter IPC, improving efficiency over JSON for binary data and large payloads.
Behavior and default changes 5
In auto mode, Gunicorn falls back to the Python parser when the gunicorn_h1c version requirement is not met.
The ASGI worker is promoted from beta to stable.
Dirty arbiters are now marked as a beta feature.
Sending SIGTTIN increases the number of dirty workers, subject to minimum worker constraints from app configurations.
Sending SIGTTOU decreases the number of dirty workers.
Fixes and other changes 16
Rejects chunk extensions containing bare CR bytes, as required by RFC 9112.
Fixes HTTP/2 ASGI request bodies being received twice, which could cause JSON parsing errors.
Makes --limit-request-line 0 mean unlimited, rather than using the default maximum; this works with both Python and fast C parsers.
FileWrapper adds __iter__ and __next__ methods for full PEP 3333 compliance.
Limit errors from the fast HTTP parser receive proper HTTP status codes 414 and 431.
Fixes the incomplete-header error with gevent or gthread workers using the uwsgi protocol behind nginx.
Fixes a RuntimeError when StopIteration is raised in an ASGI coroutine.
Fixes concurrent request failures when ASGI requests pass through an nginx proxy.
Adds graceful disconnect handling for the ASGI worker.
Lazy-imports the dirty module to improve gevent compatibility.
HTTP/1.1 ASGI streaming responses without a Content-Length header now use chunked transfer encoding, preventing clients from waiting for the connection to close.
Publishes the full exception traceback when the application fails to load.
ASGI workers shut down quickly on SIGINT and SIGQUIT, and gracefully on SIGTERM.
The header is ignored for HTTP/1.0 requests because 100-continue is only valid for HTTP/1.1 and later.
Fixes ALPN negotiation for gevent and eventlet workers when do_handshake_on_connect is False by performing the TLS handshake before checking the selected protocol.
Fixes setproctitle initialization when using systemd socket activation.
gunicorn 2418 changes
Breaking changes 4
Uses strict mode to detect invalid CIDR notation, including addresses where host bits are set.
Requires eventlet >= 0.40.3 to address CVE-2021-21419 and CVE-2025-58068.
Requires gevent >= 24.10.1 to address CVE-2023-41419 and CVE-2024-3219.
Requires tornado >= 6.5.0 to address CVE-2025-47287.
New APIs and options 5
Gunicorn now publishes official Docker images to GitHub Container Registry, based on Python 3.12 slim and configurable via environment variables.
Adds a gauge metric reporting the current socket backlog size on Linux systems.
Adds PROXY protocol v2 support and modes off, v1, v2, and auto; auto detects v1 or v2 automatically.
Adds native asyncio-based ASGI support for async Python frameworks, including HTTP/1.1 keepalive, WebSockets, and lifespan hooks; uvloop is optional.
Adds support for receiving requests from nginx via the uwsgi_pass directive.
Behavior and default changes 3
Now accepts CIDR notation for specifying trusted networks.
The inotify-based reloader now watches newly imported modules, not just those loaded at startup.
SIGTERM is now logged at info level instead of warning to reduce noise in orchestrated environments.
Fixes and other changes 6
Remains a string for backward compatibility with external tools like uvicorn.
Uses a smaller buffer size for faster timeout detection on slow or abandoned connections.
Handles SSLWantReadError to prevent worker hangs during SSL renegotiation.
Fixes socket blocking mode on keepalive connections to prevent SSL handshake failures with async workers.
Fixes a signal handling regression that caused “Unhandled signal: cld” errors on Linux when workers fail during boot.
Exception details are now printed to stderr when a worker fails to boot.