upstream prematurely closes cnx => 502 Bad Gateway to client

stefws nginx-forum at forum.nginx.org
Fri Mar 4 13:38:17 UTC 2016


I've also seen the issue when running plain nginx 1.9.11 sort like builting
a new nginx, only the issue is that upstream closes cnxs, not nginx.
Since I've discovered that our TCs had the Connector' keepAliveTimeout way
low (10 msec), mistakenly thought the units were sec and not as actually
msec.
Since increasing this a 1000 fold everything seems much better now :)

    <Connector  port="8081" protocol="HTTP/1.1"
                maxConnections="8192" maxThreads="200"
                enableLookups="false" tcpNoDelay="true"
                connectionTimeout="10000" keepAliveTimeout="900000"
                socket.soKeepAlive="true" maxKeepAliveRequests="-1" />


Thanks, will look into your suggestions next time I need to debug TC, right
now they are running at high throttle ;)

BTW I'm using Apache Tomcat/7.0.27

tcpdump snippet between nginx(10.45.69.14) and TC(10.45.69.25), where TC
RESETs cnx instead of replying:

01:15:49.744283 IP 10.45.69.14.58702 > 10.45.69.25.8081: Flags [P.], seq
31688:39753, ack 191, win 219, options [nop,nop,TS val 38708511 ecr
32578863], length 8065 
/PUT /<redacted URL> HTTP/1.1^M 
Host: mosgenericbackend^M 
Content-Length: 7811^M 
Content-Type: application/x-www-form-urlencoded^M 
User-Agent: Java/1.8.0_66^M 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2^M 
^M 
<redacted args> 
01:15:49.744311 IP 10.45.69.25.8081 > 10.45.69.14.58702: Flags [R], seq
1376851868, win 0, length 0 
01:15:49.744467 IP 10.45.69.14.58702 > 10.45.69.25.8081: Flags [.], ack 192,
win 219, options [nop,nop,TS val 38708512 ecr 32578874], length 0 
01:15:49.744480 IP 10.45.69.25.8081 > 10.45.69.14.58702: Flags [R], seq
1376851869, win 0, length 0

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,265031,265090#msg-265090



More information about the nginx mailing list