Nginx connection refused errors with no application logs
warningNginx reverse proxy receives 'Connection refused (111)' error when connecting to Gunicorn/Uvicorn upstream at rate of approximately 1 in 100,000 requests. Affected requests are not logged by Gunicorn or Uvicorn at any log level including debug. Error occurs randomly under both high load (~300 req/min) and low load (~20 req/min) with no observable pattern.
Check OS file descriptor limits with 'ulimit -n' in container. Increase container ulimit if low. Configure Gunicorn keepalive timeout to exceed upstream proxy idle timeout by adding keepalive parameter to gunicorn_config.py. Monitor gunicorn.connections.active and gunicorn.worker.connections metrics. To verify file descriptor issue, test by artificially reducing ulimit in dev environment to reproduce consistently.