Welcome! Log In Create A New Profile

Advanced

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

B.R.
March 03, 2016 06:54AM
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@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@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 03, 2016 05:10AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 03, 2016 05:57AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

B.R. March 03, 2016 06:54AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 04, 2016 02:12AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 04, 2016 05:00AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 04, 2016 05:00AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

Aleksandar Lazic March 04, 2016 05:50AM

Re: upstream prematurely closes cnx => 502 Bad Gateway to client

stefws March 04, 2016 08:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 323
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready