AWSにDjango、Nginx、Gunicorn、MySQLがあります。Nginx 502 Bad Gateway - Django - Gunicorn - 30秒以上かかるMySQLレポート(ストアドプロシージャ)を実行する場合
完了までに30秒以上かかるストアドプロシージャを呼び出すdjangoからのポストバックを実行すると、 "502 Bad Gateway" nginx/1.4.6(Ubuntu)が返されます。
確かにタイムアウトの問題のように見え、this postで解決するはずです。
しかし、それはうまくいきません。
description "Gunicorn application server handling formManagement django app"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid ubuntu
setgid www-data
chdir /home/ubuntu/AARC-ServiceManager/ServerSide/formManagement
exec ve/bin/gunicorn --timeout 300 --workers 3 --bind unix:/home/ubuntu/AARC-ServiceManager/ServerSide/formManagement/formManagement.sock formManagement.wsgi:application
そして、私のNginx.conf:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
# set client body size (max http request size) #
client_max_body_size 50M;
#upping the timeouts to allow time for the DB to return from a long running sproc
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
任意の考えここ
は私のgunicorn.confファイルのですか?
UPDATE: これはnginxのエラーログにエラーである: [エラー] 14316#0:* 13上流の早期閉鎖上流側からの応答ヘッダを読みながら接続...
実際にトランザクションが実際にどのくらいかかると思いますか? – Dashdrum
@ダッシュドラムヘイダッシュドラム。はい、エラーを再現するためにストアドプロシージャを作成しました。 procを35秒間「スリープ」すると、エラーが発生します。 – aero
リクエストはajaxに由来していますか? – serg