Nginx was closing the client connection after exactly 60 seconds on requests like clip_video (ffmpeg, 5-40 min) because send_timeout and proxy_send_timeout both default to 60s. proxy_read_timeout was already 2100s but the other two timeouts were still at defaults. With proxy_buffering off, Nginx holds the write path to the client open as soon as the upstream connection is established. If the upstream sends no data for 60s (e.g. ffmpeg processing), Nginx treats the idle write path as stalled and closes the client connection, logging 499 (Client Closed Request). Fixed: raise proxy_send_timeout and send_timeout to 2100s to match proxy_read_timeout in the main location block. Also raised the Gunicorn default timeout from 30s to 120s in gunicorn_conf.py as a belt-and-suspenders measure (AE_API_GUNICORN_TIMEOUT env var takes precedence). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
816 B
Python
31 lines
816 B
Python
import os
|
|
|
|
# Gunicorn config variables
|
|
loglevel = os.getenv('AE_LOG_LVL', 'warning')
|
|
|
|
accesslog = "-" # stdout
|
|
errorlog = "-" # stderr
|
|
|
|
# Use /dev/shm for the control socket to avoid permission issues on volume mounts
|
|
control_socket = "/dev/shm/gunicorn.ctl"
|
|
|
|
# ... (existing bind/chdir) ...
|
|
bind = "0.0.0.0:5005"
|
|
worker_tmp_dir = "/dev/shm"
|
|
chdir = "/srv/aether_api"
|
|
wsgi_app = "app.main:app"
|
|
|
|
# Numeric variables must be integers
|
|
timeout = int(os.getenv('AE_API_GUNICORN_TIMEOUT', 120))
|
|
graceful_timeout = int(os.getenv('AE_API_GUNICORN_GRACEFUL_TIMEOUT', 30))
|
|
keepalive = int(os.getenv('AE_API_GUNICORN_KEEPALIVE', 4))
|
|
|
|
reload = False
|
|
worker_class = "uvicorn.workers.UvicornWorker"
|
|
|
|
workers = int(os.getenv('AE_API_GUNICORN_WORKERS', 2))
|
|
threads = int(os.getenv('AE_API_GUNICORN_THREADS', 2))
|
|
|
|
|
|
# umask = '007'
|