You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/22 03:05:50 UTC

[GitHub] [apisix] spacewander commented on issue #4649: request help: Why is the request forwarded to an unhealthy node

spacewander commented on issue #4649:
URL: https://github.com/apache/apisix/issues/4649#issuecomment-884626291


   I try to reproduce with:
   ```
   upstreams:
       -
           id: 1
           name: "nginx"
           nodes:
               "127.0.0.1:8080": 1 # unreachable
               "127.0.0.1:1980": 1
           type: roundrobin
           checks:
               active:
                   http_path: "/get"
                   healthy:
                       interval: 2
                       successes: 1
   routes:
       -
           uri: /*
           upstream_id: 1
   #END
   
   ```
   
   Only the first few requests hit port 8080. After `8080` is marked as unhealthy, like:
   
   ```
   2021/07/22 11:02:22 [warn] 5473#5473: *645 [lua] healthcheck.lua:1107: log(): [healthcheck] (upstream#/upstreams/1) unhealthy TCP increment (2/2) for '(127.0.0.1:8080)', context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   ```
   
   every request hit port 1980 only. 
   
   Here is my result:
   ```
    incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   OK%                                                                                                                                                                                 incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   <html>
   <head><title>502 Bad Gateway</title></head>
   <body>
   <center><h1>502 Bad Gateway</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
    incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   OK%                                                                                                                                                                                 incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   OK%                                                                                                                                                                                 incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   OK%                                                                                                                                                                                 incubator-apisix (63f779ae*) 0
    ¥ curl http://127.0.0.1:9080/get
   OK%                                                                                                                                                                                 incubator-apisix (63f779ae*) 0
    ¥ wrk http://127.0.0.1:9080/get
   Running 10s test @ http://127.0.0.1:9080/get
     2 threads and 10 connections
     Thread Stats   Avg      Stdev     Max   +/- Stdev
       Latency    10.05ms    2.32ms  33.74ms   88.89%
       Req/Sec   501.77     46.83   600.00     72.00%
     9996 requests in 10.01s, 1.54MB read
   Requests/sec:    998.87
   Transfer/sec:    157.98KB
   ```
   
   You can check the error log and decrease the log level or add more logs to see what happened indeed.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org