There is one process backend which take around 1-2 minutes to process. The loading screen runs for 1 minute and shows 504 Gateway Timeout
Here's the log in nginx.access.log
172.18.0.2 - - [16/Dec/2022:23:54:02 0000] "POST /some_request HTTP/1.1" 499 0 "http://localhost/some_url" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
But from the django debug log, I can see that the POST request is still processing at the backend
docker-compose.yml timeout is set to 300, without it, the browser will return 502 error (connection prematurely closed)
services:
web:
image: genetic_ark_web:2.0.0
build: .
command: bash -c "python manage.py collectstatic --noinput && gunicorn ga_core.wsgi:application --bind :8000 --timeout 300 --workers 2 --threads 4"
This is all the params I have tried in nginx.conf but still the 504 timeout is returned after 60s
server {
# port to serve the site
listen 80;
# optional server_name
server_name untitled_name;
...
# request timed out -- default 60
client_body_timeout 300;
client_header_timeout 300;
# if client stop responding, free up memory -- default 60
send_timeout 300;
# server will close connection after this time -- default 75
keepalive_timeout 300;
location /url_pathway/ {
proxy_pass http://ga;
# header
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;
keepalive_timeout 300s;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
uwsgi_read_timeout 300s;
uwsgi_connect_timeout 300s;
Any idea which parameter might be controlling the timeout?
CodePudding user response:
Apparently not caused by nginx-container or web-container. Fixed by changing timeout in nginx-proxy which is timing out causing 499 error in nginx access log while web container is continuing its backend process
Added below in nginx.conf for nginx-container
proxy_read_timeout 300s;
For nginx-proxy, proxy_read_timeout 300s;
is added to the config too