604 Commits

Author SHA1 Message Date
Benoit Chesneau
fa5e319f15 docs(http2): add ASGI example demonstrating priority and trailers
Add complete HTTP/2 example in examples/http2_features/:
- ASGI app showing priority access and trailer sending
- Test script using raw h2 library for HTTP/2 testing
- Docker setup for easy testing
- Documentation update referencing the example

The example demonstrates:
- Reading http.response.priority extension in ASGI scope
- Sending http.response.trailers messages
- Multiple streams on the same connection
2026-01-27 13:15:36 +01:00
Benoit Chesneau
0f298e4838 feat(http2): add response trailer support 2026-01-27 12:33:12 +01:00
Benoit Chesneau
655716a181 feat(http2): add stream priority support (RFC 7540 Section 5.3) 2026-01-27 11:44:33 +01:00
Benoit Chesneau
66d0880c74 Address PR #3468 review feedback
- Guard early_hints callback against calls after response started
- Fix :authority precedence over Host header per RFC 9113 section 8.3.1
- Add nginx early_hints documentation link
- Use standard port 443 in curl examples
2026-01-27 09:59:35 +01:00
Benoit Chesneau
955893b6ab Add HTTP/2 documentation
- Add docs/content/guides/http2.md with comprehensive HTTP/2 guide
  - Quick start and requirements
  - Configuration options and settings
  - Worker compatibility matrix
  - HTTP 103 Early Hints usage for WSGI and ASGI
  - Production deployment with nginx
  - Troubleshooting guide
- Update docs/content/asgi.md to reflect HTTP/2 support
- Update docs/content/2026-news.md with 25.0.0 release featuring
  HTTP/2 and Early Hints
- Regenerate docs/content/reference/settings.md with HTTP/2 settings
2026-01-27 09:59:35 +01:00
Benoit Chesneau
1fe9e5816e
Merge pull request #3460 from benoitc/feature/dirty-arbiters
feat: add dirty arbiters for long-running blocking operations
2026-01-27 09:45:05 +01:00
Benoit Chesneau
891990befa docs(dirty): update streaming from future to current feature 2026-01-26 09:39:46 +01:00
Benoit Chesneau
8663740907
Add uWSGI protocol support to ASGI worker (#3467)
Add uWSGI protocol support to ASGI worker

- Implements AsyncUWSGIRequest class extending sync UWSGIRequest to reuse parsing logic with async I/O
- ASGI protocol handler selects between HTTP and uWSGI based on --protocol config option
- Allows gunicorn's ASGI worker to receive requests from nginx using uwsgi_pass directive
- Includes unit tests and Docker integration tests
2026-01-25 14:45:07 +01:00
Benoit Chesneau
d85be79102 docs: regenerate settings.md with dirty arbiter options 2026-01-25 10:33:38 +01:00
Benoit Chesneau
cc39ed922e examples(dirty): add streaming chat demo with SSE
Add a lightweight chat simulator demonstrating dirty worker streaming:
- Token-by-token SSE streaming via async generators
- FastAPI endpoint with browser UI
- Multiple canned responses based on keywords
- Docker deployment with docker-compose
- Integration tests for SSE protocol

Update docs/content/dirty.md to link to both examples.
2026-01-25 10:26:12 +01:00
Benoit Chesneau
ae8665c4d5 docs(dirty): expand architecture, signal handling, and health monitoring
- Enhance architecture diagram with Unix socket paths, signal flow, and
  heartbeat indicators
- Add process relationships table
- Expand signal handling section with flow diagram, comprehensive signal
  reference table, and async handling explanation
- Add new "Liveness and Health Monitoring" section covering heartbeat
  mechanism, timeout detection, parent death detection, orphan cleanup,
  and respawn behavior
- Add link to embedding service example
2026-01-25 10:23:25 +01:00
Benoit Chesneau
f6418d4eb0 feat(dirty): add streaming support and async client benchmarks
Add support for streaming responses when dirty app actions return
generators (sync or async). This enables real-time delivery of
incremental results for use cases like LLM token generation.

Features:
- Streaming protocol with chunk/end/error message types
- Worker support for sync and async generators
- Arbiter forwarding of streaming messages
- Deadline-based timeout handling
- Async client streaming API

Protocol:
- Chunk messages (type: "chunk") contain partial data
- End messages (type: "end") signal stream completion
- Error messages can occur mid-stream

New files:
- benchmarks/dirty_streaming.py: Streaming benchmark suite
- tests/dirty/test_*_streaming*.py: Streaming test coverage
- docs/content/dirty.md: Streaming documentation with examples
2026-01-25 10:23:25 +01:00
Benoit Chesneau
9b0e87deb8 docs(dirty): clarify application initialization sequence 2026-01-25 10:23:25 +01:00
Benoit Chesneau
c914f336b8 docs: add dirty arbiters to navigation and changelog 2026-01-25 10:23:25 +01:00
Benoit Chesneau
77222b8017 feat: add dirty arbiters for long-running blocking operations
Introduce Dirty Arbiters - a separate process pool for executing
long-running, blocking operations (AI model loading, heavy computation)
without blocking HTTP workers. Inspired by Erlang's dirty schedulers.

Key features:
- Completely separate from HTTP workers - can be killed/restarted independently
- Stateful - loaded resources persist in dirty worker memory
- Message-passing IPC via Unix sockets with JSON serialization
- Explicit execute() API from HTTP workers
- Asyncio-based for clean concurrent handling

Architecture:
- DirtyArbiter: manages the dirty worker pool, routes requests
- DirtyWorker: executes functions, maintains state, handles requests
- DirtyClient: sync/async API for HTTP workers to call dirty apps
- DirtyProtocol: length-prefixed JSON messages over Unix sockets
- DirtyApp: base class for dirty applications

Configuration options:
- dirty_apps: list of import paths for dirty applications
- dirty_workers: number of dirty workers (default: 0)
- dirty_timeout: task timeout in seconds (default: 300)
- dirty_graceful_timeout: shutdown timeout (default: 30)

Lifecycle hooks:
- on_dirty_starting(arbiter)
- dirty_post_fork(arbiter, worker)
- dirty_worker_init(worker)
- dirty_worker_exit(arbiter, worker)

Includes comprehensive test suite with 164 tests covering:
- Protocol encoding/decoding
- Worker and arbiter lifecycle
- Client sync/async APIs
- Signal handling
- Error handling and timeouts
- Integration tests
2026-01-25 10:21:18 +01:00
Paul J. Dorn
481dbf2e9b
Publish full exception when the application fails to load (#3462)
* Python3: refactor returned traceback

Exceptions provide __traceback__ reference since Python 3.0
(and creating cyclic references has not been big deal since Python 2.2)

* --reload: publish entire exception, not just traceback

This is dangerous insofar as the exception text is more
likely to contain secrets than the quoted lines from traceback are.

However, the difference between the two is minor compared to the
primary danger of enabling this on a production machine, so focus
on that instead!
2026-01-25 09:41:39 +01:00
Benoit Chesneau
f0952e5874 docs: add sponsors section to website homepage 2026-01-24 02:19:14 +01:00
Benoit Chesneau
375e79e95b release: bump version to 24.1.1 2026-01-24 02:13:42 +01:00
Benoit Chesneau
6841804116 docs: remove incorrect PR reference from Docker changelog entry 2026-01-24 00:02:56 +01:00
Benoit Chesneau
abce0ca9cb docs: add 24.1.1 changelog entry for forwarded_allow_ips fix 2026-01-23 23:53:29 +01:00
Benoit Chesneau
d73ff4b1d8 docs: update main changelog with 24.1.0 2026-01-23 22:16:37 +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
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
c0c4b65f0f docs: regenerate settings.md 2026-01-23 11:41:15 +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
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
38e23175e7 docs: regenerate settings.md with updated worker versions 2026-01-23 09:57:33 +01:00
Benoit Chesneau
e021e3e93f docs: Update 24.0.0 changelog with security fixes 2026-01-23 01:39:23 +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
Benoit Chesneau
19a2efec63 Migrate docs build to MkDocs 2026-01-23 01:20:03 +01:00
Benoit Chesneau
58d803977d bump version to 24.0.0, remove sphinx docs 2026-01-23 01:12:46 +01:00
Benoit Chesneau
56b5ad87f8
Restore Python 3.10 and 3.11 support (#3425)
This change extends Python support back to 3.10 and 3.11, which are
still actively maintained by the PSF:
- Python 3.10: Security support until Oct 2026
- Python 3.11: Active support (latest feature release)
- Python 3.12: Active support
- Python 3.13: Latest stable release

The previous change to support only 3.12+ was too restrictive as many
users are still on Python 3.10 and 3.11 in production environments.

Changes:
- Updated pyproject.toml to set minimum Python to 3.10
- Added Python 3.10, 3.11, and PyPy 3.10 to CI matrix
- Updated all documentation to reflect Python 3.10+ requirement
- Maintained compatibility with latest pylint for Python 3.12+
2025-10-05 22:45:21 +02:00