ryan4yin edited a comment on issue #4685:
URL: https://github.com/apache/apisix/issues/4685#issuecomment-888164938


   we have repruduce this using nginx 1.19.3, it's the behavior of nginx 
upstream & keepalive configs, 
   the 502 is NOT retured by upstream, it just indicates that nginx failed to 
read data from upstream, it we found the corresponding log in `error.log`(I 
mocked some infos):
   
   ```
   2021/07/27 13:30:30 [error] 59#59: *34290 upstream prematurely closed 
connection while reading response header from upstream, client: 172.11.145.126, 
server: _, request: "GET /eks-test HTTP/1.1", upstream: 
"http://10.100.154.110:8080/eks-test";, host: "test.xxx"
   2021/07/27 13:33:23 [error] 70#70: *74921 upstream prematurely closed 
connection while reading response header from upstream, client: 172.11.193.70, 
server: _, request: "GET /eks-test HTTP/1.1", upstream: 
"http://10.100.154.110:8080/eks-test";, host: "test.xxx"
   2021/07/27 13:36:55 [error] 62#62: *130238 upstream prematurely closed 
connection while reading response header from upstream, client: 172.11.187.255, 
server: _, request: "GET /eks-test HTTP/1.1", upstream: 
"http://10.100.154.110:8080/eks-test";, host: "test.xxx"
   2021/07/27 13:42:36 [error] 61#61: *221268 upstream prematurely closed 
connection while reading response header from upstream, client: 172.11.145.126, 
server: _, request: "GET /eks-test HTTP/1.1", upstream: 
"http://10.100.154.110:8080/eks-test";, host: "test.xxx"
   2021/07/27 19:46:36 [error] 73#73: *5812952 recv() failed (104: Connection 
reset by peer) while reading response header from upstream, client: 
172.11.145.126, server: _, request: "GET /eks-test HTTP/1.1", upstream: 
"http://10.100.154.110:8080/eks-test";, host: "test.xxx"
   ```
   
   Some cases that may cause this error:
   
   - upstream has closed the connection, but nginx DO NOT know it yet, nginx 
still send request using this connection.
   - upstream server has dead, but the linux kernel are still listening the 
port.
   
   kill the upstream server may cause this error.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to