3279 Commits

Author SHA1 Message Date
Benoit Chesneau
d73ff4b1d8 docs: update main changelog with 24.1.0 2026-01-23 22:16:37 +01:00
Benoit Chesneau
53f2c31012 ci: allow docs deploy on workflow_dispatch 2026-01-23 22:14:05 +01:00
Benoit Chesneau
eab5f0b1a5 ci: trigger Docker publish on tags with or without v prefix 2026-01-23 21:54:49 +01:00
Benoit Chesneau
a20d3fb220 docs: add Docker image to 24.1.0 changelog 2026-01-23 21:49:50 +01:00
Benoit Chesneau
7ef34796ae docs: add SIGCLD fix to changelog 2026-01-23 21:26:35 +01:00
Benoit Chesneau
3179789f46 fix: handle SIGCLD alias for SIGCHLD on Linux
On Linux, SIGCLD and SIGCHLD are aliases for the same signal number (17).
The SIG_NAMES dict iteration order can map to either name, causing
"Unhandled signal: cld" errors when workers fail during boot.

Fixes #3453
2026-01-23 21:25:07 +01:00
Benoit Chesneau
a3a59b2f56 chore: update version placeholder to 24.1.0 2026-01-23 19:27:14 +01:00
Benoit Chesneau
8b86f6c36d fix: install gunicorn from source in Docker image 2026-01-23 19:26:39 +01:00
Benoit Chesneau
076bef68d3 fix: default to 0.0.0.0 instead of [::] for broader compatibility 2026-01-23 19:19:38 +01:00
Benoit Chesneau
6a83feecd6 docs: add running in background section to Docker guide 2026-01-23 19:16:40 +01:00
Benoit Chesneau
4e656d3a91 fix: use documented worker formula (2 * CPU + 1) in Docker image 2026-01-23 19:13:47 +01:00
Benoit Chesneau
469110d647 feat: add official Docker image with GHCR publishing workflow
- Add docker/Dockerfile with non-root user and configurable environment
- Add GitHub Actions workflow to build multi-platform images (amd64/arm64)
- Publish to ghcr.io/benoitc/gunicorn on version tags
- Update documentation with official image usage examples
2026-01-23 19:09:18 +01:00
Benoit Chesneau
7894d1c170 release: prepare 24.1.0
- Bump version to 24.1.0
- Add PROXY protocol v2 documentation to deploy guide
- Add 24.1.0 changelog with new features and bug fixes
- Update all docs.gunicorn.org URLs to gunicorn.org
2026-01-23 18:47:17 +01:00
Benoit Chesneau
f3190f84cc
feat: add PROXY protocol v2 support with version selection (#3451)
Extend --proxy-protocol to accept version values (off, v1, v2, auto) instead
of being boolean-only. This allows explicit control over which PROXY protocol
versions are accepted.

Changes:
- Add InvalidProxyHeader exception for v2 binary header errors
- Add validate_proxy_protocol() validator with backwards compatibility
- Update ProxyProtocol setting with nargs="?" and const="auto"
- Add PROXY v2 constants (PP_V2_SIGNATURE, PPCommand, PPFamily, PPProtocol)
- Add _parse_proxy_protocol_v1() and _parse_proxy_protocol_v2() methods
- Update both sync (message.py) and async (asgi/message.py) parsers
- Add hex escape handling in treq.py for v2 binary test data
- Add test cases for v2 TCPv4 and TCPv6

Backwards compatible: --proxy-protocol alone (or True) maps to "auto".

Closes #2912
2026-01-23 18:40:44 +01:00
Benoit Chesneau
f95ac41b8f fix: use smaller buffer in finish_body for faster timeout
Reduce buffer size from 8192 to 1024 bytes when discarding unread
body data, allowing timeouts to trigger more quickly on slow or
stalled connections.
2026-01-23 14:46:40 +01:00
Benoit Chesneau
66963367f3 fix: set socket to blocking mode on keepalive connections
On keepalive connections, finish_request() sets the socket to non-blocking
for selector registration. When the connection is reused, handle() calls
conn.init() which returns early (already initialized) without restoring
blocking mode. This caused SSLWantReadError when WSGI apps read the
request body on SSL connections.

Fix by explicitly setting blocking mode at the start of handle().

Fixes #3448
2026-01-23 14:40:40 +01:00
Benoit Chesneau
c0c4b65f0f docs: regenerate settings.md 2026-01-23 11:41:15 +01:00
Benoit Chesneau
f22cd6558e feat: add socket backlog metric (Linux only)
Add --enable-backlog-metric option to emit a gunicorn.backlog histogram
metric showing connections waiting in the socket backlog. This helps
identify worker saturation and concurrency issues.

Also distinguishes between timer (|ms) and histogram (|h) statsd metric
types per the statsd spec.

Note: Only works on Linux using TCP_INFO from getsockopt.

Closes #2407
Partially fixes #2057
2026-01-23 11:39:05 +01:00
Benoit Chesneau
e52ac46e29 feat: support CIDR networks in forwarded_allow_ips and proxy_allow_ips
Use Python's ipaddress module to support IP networks in allow lists.
Individual IP addresses are converted to /32 (IPv4) or /128 (IPv6)
networks. CIDR notation (e.g., 192.168.0.0/16) is now supported.

Fixes #1485
Closes #2390
2026-01-23 11:39:05 +01:00
Benoit Chesneau
b0d38928c8 feat: InotifyReloader now watches newly loaded modules
Refactor reloader to share code via ReloaderBase class. InotifyReloader
now calls refresh_dirs() on each event loop timeout (~1 sec) to watch
directories for dynamically loaded modules (e.g., Django dynamic imports).

Fixes #1790
Closes #1791
2026-01-23 11:39:05 +01:00
Benoit Chesneau
bbc9bba95e fix: log SIGTERM as info level, not warning
SIGTERM is expected during graceful shutdown and reload operations.
Logging it as warning level causes unnecessary noise in error logs.
SIGKILL remains at error level (suggests OOM), other signals at warning.

Closes #3094
2026-01-23 11:39:05 +01:00
Benoit Chesneau
19d07bd4af fix: print exception to stderr on worker boot failure
When a worker fails to boot, the exception is now printed to stderr
(in addition to being logged), consistent with AppImportError handling.
This makes boot failures more visible to users.

Closes #2933
2026-01-23 11:39:05 +01:00
Benoit Chesneau
56abeaf105 fix: unreader.unread() now prepends data to buffer
The unread method was incorrectly appending data to the end of the
buffer instead of prepending it to the beginning. This caused issues
when reading partial data and then unreading it.

Closes #2915
Closes #2346
2026-01-23 11:39:05 +01:00
Benoit Chesneau
8e75b3aba3 fix: prevent RecursionError when pickling Config
On Python 3.8+ with macOS, the multiprocessing module uses 'spawn' by
default which pickles objects. When pickle.load tries to read
__setstate__ before __dict__ is restored, it hits __getattr__ causing
infinite recursion. Adding a special case for 'settings' prevents this.

Closes #2401
2026-01-23 11:39:05 +01:00
Benoit Chesneau
a182066bea fix: use proper exception chaining with 'raise from' in glogging.py
Use 'raise X from e' syntax instead of just 'raise X' when wrapping
exceptions. This provides more accurate exception chaining messages
("The above exception was the direct cause of" vs "During handling of").

Closes #2360
2026-01-23 11:39:05 +01:00
Benoit Chesneau
33e5337395 docs: fix post_request hook signature description
The description incorrectly stated the callable accepts two parameters
(Worker and Request), but the signature shows four parameters including
environ and resp.

Closes #2592
2026-01-23 11:39:05 +01:00
Benoit Chesneau
7c22955837
Merge pull request #3450 from benoitc/fix/ssl-want-read-error-3448
fix: handle SSLWantReadError in finish_body() (#3448)
2026-01-23 11:17:46 +01:00
Benoit Chesneau
4ef635446b docs: add dogstatsd_tags example to description
Clarify the expected format with a concrete example.

Closes #3288
2026-01-23 10:37:30 +01:00
Benoit Chesneau
36f3807a74 docs: remove RuntimeDirectory from systemd service example
The RuntimeDirectory directive is unused by gunicorn and causes
unnecessary directory creation in /run.

Closes #3341
2026-01-23 10:36:42 +01:00
Benoit Chesneau
46e7726838 fix: make syslog_addr default platform-neutral in docs
The syslog_addr setting has different defaults depending on the
platform (macOS, FreeBSD, OpenBSD, Linux). Added default_doc to
show all platform-specific defaults in the documentation, ensuring
consistent output regardless of which platform generates the docs.

Also kept the diagnostic git diff in CI for future debugging.
2026-01-23 10:08:01 +01:00
Benoit Chesneau
f68ad2e095 ci: add git diff output to diagnose settings.md issue 2026-01-23 10:04:57 +01:00
Benoit Chesneau
38e23175e7 docs: regenerate settings.md with updated worker versions 2026-01-23 09:57:33 +01:00
Benoit Chesneau
0e175a2d34 fix: resolve lint issues and remove obsolete Sphinx references
- Fix lint issues in test_gthread.py:
  - Remove unused imports (queue, partial, http)
  - Move fcntl import to top level
  - Remove unused variable assignment
  - Replace unnecessary lambdas with method references
  - Add blank lines before nested function definitions (E306)

- Update .github/workflows/lint.yml:
  - Replace Sphinx docs check with MkDocs settings generator
  - docs/source directory no longer exists after MkDocs migration

- Update tox.ini:
  - Remove docs/source/*.rst lint (directory doesn't exist)
  - Add tests/test_gthread.py to lint targets
2026-01-23 09:56:32 +01:00
Benoit Chesneau
47b9a18619 fix: handle SSLWantReadError in finish_body() (#3448)
The finish_body() function can raise ssl.SSLWantReadError when
discarding unread request body data on SSL connections. This causes
TLS requests to fail intermittently with "Invalid request" errors.

Handle SSLWantReadError by treating it as "no more data to read".
This is safe because finish_body() only discards leftover data before
keepalive - if SSL says "need to wait for more data", there's nothing
left to discard.

Fixes #3448
2026-01-23 09:38:41 +01:00
Benoit Chesneau
cae2ef4fe4 github: Consolidate triage into single Issue Triage category 2026-01-23 02:23:31 +01:00
Benoit Chesneau
6a46d66a56 github: Add discussions-first triage workflow
Redirect issue creation to GitHub Discussions for proper triage:
- Disable blank issues, redirect to discussion categories
- Add structured discussion templates for bugs, features, questions
- Add preapproved issue template for maintainer use only
- Update CONTRIBUTING.md to reflect new workflow
2026-01-23 02:13:34 +01:00
Benoit Chesneau
e021e3e93f docs: Update 24.0.0 changelog with security fixes 2026-01-23 01:39:23 +01:00
Benoit Chesneau
3960372b82
Merge pull request #3426 from benoitc/website-2025
Migrate docs build to MkDocs
2026-01-23 01:20:42 +01:00
Benoit Chesneau
d34d3de01b docs: Set release date for 24.0.0 2026-01-23 01:20:03 +01:00
Benoit Chesneau
066e6d8bb3 docs: Move ASGI worker tab after Gthread 2026-01-23 01:20:03 +01:00
Benoit Chesneau
c6b1159483 docs: Add Tornado worker to design page 2026-01-23 01:20:03 +01:00
Benoit Chesneau
c959daeb82 docs: Redesign architecture page with visual components
Add tabbed worker types, comparison table, decision guide admonitions,
and scaling callouts. Rename master to arbiter throughout.
2026-01-23 01:20:03 +01:00
Benoit Chesneau
571bc121d1 docs: Add punchy theme with vibrant colors and modern features
- Brighter green palette (#00a650, #00c853) with teal accent
- Dark/light mode toggle with system preference detection
- Gradient header, tabs, buttons, and footer
- Inter font for text, JetBrains Mono for code
- Sticky navigation tabs, auto-hide header
- Progress indicator, search sharing, breadcrumbs
- Custom scrollbars and selection highlighting
- Enhanced code blocks, tables, and admonitions
2026-01-23 01:20:03 +01:00
Benoit Chesneau
73adc7cb29 docs: Add collapsible TOC for settings reference
- Change settings headers to h2 sections / h3 settings for TOC visibility
- Enable toc.integrate to show TOC in left sidebar
- Add JavaScript for collapsible section toggles on settings page
2026-01-23 01:20:03 +01:00
Benoit Chesneau
dcec6e701a docs: Modern landing page with custom template
- Add custom home.html template to break out of MkDocs constraints
- Create Caddy-inspired minimal CSS for landing page
- Redesign hero section with terminal demo
- Add framework tags and worker type cards
- Full-width sections with vertical narrative flow
- Dark mode support
2026-01-23 01:20:03 +01:00
Benoit Chesneau
5ea4eb340a docs: Add 2026 changelog and modernize README 2026-01-23 01:20:03 +01:00
Benoit Chesneau
0b961036b7 docs: Configure GitHub Pages deployment with custom domain 2026-01-23 01:20:03 +01:00
Benoit Chesneau
e9bc51cce4 docs: Modernize landing page with hero, pillars, and framework cards 2026-01-23 01:20:03 +01:00
Benoit Chesneau
819d2a2490 docs: Add quickstart guide and Docker deployment 2026-01-23 01:20:03 +01:00
Benoit Chesneau
0a697cde7f docs: Add ASGI worker and uWSGI protocol documentation 2026-01-23 01:20:03 +01:00