upstream prematurely closes cnx => 502 Bad Gateway to client
B.R.
reallfqq-nginx at yahoo.fr
Thu Mar 3 11:52:15 UTC 2016
The HTTP specification states every request shall receive a response.
Your backend closes the connection while nginx is awaiting/reading the
headers.
The problem definitely comes from your backend. You could use tcpdump
between nginx and your backend to record what they say to each other.
Try to correlate logs from nginx with logs from your backend.
---
*B. R.*
On Thu, Mar 3, 2016 at 11:57 AM, stefws <nginx-forum at forum.nginx.org> wrote:
> My config btw:
>
> user imail;
> worker_processes auto;
> daemon on;
> master_process on;
> error_log logs/mos_error.tcp debug_tcp;
> error_log logs/mos_error.log;
> pid /opt/imail/nginx/logs/mos_nginx.pid;
> worker_rlimit_nofile 200000;
> worker_rlimit_core 500M;
> working_directory /opt/imail/nginx;
> events {
> worker_connections 25000;
> use epoll;
> multi_accept off;
> }
> http {
> log_format testlogs '$remote_addr - $remote_user [$time_local] '
> '"$request" $status $body_bytes_sent '
> '"$http_referer" "$upstream_addr" '
> '$request_time $upstream_response_time';
> access_log logs/mos_access.log;
> sendfile on;
> keepalive_requests 500000;
> keepalive_timeout 20s;
> tcp_nopush on;
> tcp_nodelay on;
> client_body_buffer_size 128k;
> client_body_temp_path /dev/shm/mos_nginx/client_temp 1 2;
> open_file_cache max=25000 inactive=30s;
> open_file_cache_valid 60s;
> open_file_cache_min_uses 2;
> open_file_cache_errors on;
> upstream mosgenericbackend {
> server mss1:8081;
> server mss2:8081;
> server mss3:8081;
> server mss4:8081;
> healthcheck_enabled;
> healthcheck_delay 1000;
> healthcheck_timeout 1000;
> healthcheck_failcount 2;
> healthcheck_send 'GET /mxos/monitor HTTP/1.0';
> keepalive 300;
> }
> server {
> listen 8081;
> keepalive_timeout 600s;
> client_max_body_size 0;
> location /mxos/ {
> proxy_http_version 1.1;
> proxy_set_header Connection "";
> proxy_pass http://mosgenericbackend;
> proxy_connect_timeout 2;
> more_set_headers "Content-Type: application/json";
> }
> location /mxos/health_status {
> healthcheck_status;
> }
> proxy_connect_timeout 60;
> proxy_read_timeout 30;
> proxy_send_timeout 60;
> }
> }
>
> My [vendor patched/supplied due to application specific load
> balancing+health check] nginx version:
>
> # /opt/imail/nginx/sbin/nginx -V
> nginx version: nginx/1.7.4
> built by gcc 3.4.6 20060404 (Red Hat 3.4.6-3)
> TLS SNI support disabled
> configure arguments: --with-debug
>
> --add-module=/bld/current/emailmx90_git_blds/emailmx90_contrib_shared/contrib/nginx_1.7.4/source/addons/healthcheck_nginx_upstreams-master
>
> --add-module=/bld/current/emailmx90_git_blds/emailmx90_contrib_shared/contrib/nginx_1.7.4/source/addons/headers-more-nginx-module-0.23
>
> --add-module=/bld/current/emailmx90_git_blds/emailmx90_contrib_shared/contrib/nginx_1.7.4/source/addons/yaoweibin-nginx_tcp_proxy_module-f2156ef
>
> Posted at Nginx Forum:
> https://forum.nginx.org/read.php?2,265031,265032#msg-265032
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160303/3c69e31c/attachment.html>
More information about the nginx
mailing list