From fc4a9c926f9309b1f7b5ee29846d0ebb77b65207 Mon Sep 17 00:00:00 2001 From: oib Date: Sun, 27 Jul 2025 09:00:41 +0200 Subject: [PATCH] Fix upload timeout issue: increase Gunicorn worker timeout to 300s - Increased timeout from 60s to 300s (5 minutes) for large file uploads - Added max_requests, max_requests_jitter, and worker_connections settings - Removed limits on request line and field sizes to handle large uploads - Also updated Nginx configuration with optimized timeout settings for /upload endpoint This resolves the 502 Bad Gateway errors that were occurring during large file uploads due to worker timeouts. --- gunicorn.conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 0a53c4d..3e7083c 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -1,10 +1,16 @@ bind = "0.0.0.0:8000" workers = 2 # Tune based on available CPU cores worker_class = "uvicorn.workers.UvicornWorker" -timeout = 60 +timeout = 300 # Increased from 60 to 300 seconds (5 minutes) keepalive = 30 loglevel = "info" accesslog = "-" errorlog = "-" proxy_allow_ips = "*" +max_requests = 1000 +max_requests_jitter = 50 +worker_connections = 1000 +limit_request_line = 0 # No limit on request line size +limit_request_field_size = 0 # No limit on field size +limit_request_fields = 100 # Limit number of header fields