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/04/21 14:04:52 UTC

[GitHub] [apisix] Ben0625 opened a new issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Ben0625 opened a new issue #4103:
URL: https://github.com/apache/apisix/issues/4103


   ### Issue description
   One request with unhealthy code returned will cause multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1. 
   
   ### Environment
   * apisix version: 2.0
   * OS: 3.10.0-693.el7.x86_64
   * OpenResty version: openresty/1.17.8.2
   * etcd version: 3.4.13
   * apisix-dashboard version: 2.0
   
   ### Minimal test code / Steps to reproduce the issue
   The route configuration in etcd is below:
   ```
   {
   	"id": "route_2050210843",
   	"create_time": 1618455175,
   	"update_time": 1619013202,
   	"uris": ["/test1.do"],
   	"name": "route-2050210843",
   	"desc": "health_check_test",
   	"methods": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
   	"vars": [],
   	"upstream": {
   		"nodes": [{
   			"host": "172.25.69.182",
   			"port": 8080,
   			"weight": 1
   		}, {
   			"host": "172.25.70.116",
   			"port": 8080,
   			"weight": 1
   		}],
   		"timeout": {
   			"connect": 6,
   			"read": 6,
   			"send": 6
   		},
   		"type": "roundrobin",
   		"checks": {
   			"active": {
   				"healthy": {
   					"interval": 100,
   					"successes": 10
   				},
   				"host": "172.25.69.182",
   				"http_path": "/check.do",
   				"req_headers": [""],
   				"timeout": 3,
   				"unhealthy": {
   					"http_failures": 5,
   					"interval": 3
   				}
   			},
   			"passive": {
   				"healthy": {
   					"http_statuses": [200],
   					"successes": 2
   				},
   				"unhealthy": {
   					"http_failures": 5,
   					"http_statuses": [500, 502, 504],
   					"tcp_failures": 1
   				}
   			}
   		}
   	},
   	"labels": {
   		"serve": "2050210843"
   	}
   }
   ```
   
   1. Set a route with two upstreams and healthcheck active and passive configuration. One upstream always return 500 and another always return 200.
   2. Send a request to trigger creating new checker. It will be passed to the normal upstream.
   3. Send a second request, it will be passed to the unnormal upstream.
   
   ### What's the actual result? 
   One request with unnormal upstream will cause three times unhealthy HTTP increment.
   
   `2021/04/21 21:54:00 [warn] 73450#73450: *3017774 [lua] healthcheck.lua:1142: log(): [healthcheck] (upstream#/apisix/routes/route_2050210843) unhealthy HTTP increment (1/5) for '172.25.69.182(172.25.69.182:8080)' while logging request, client: 10.58.50.104, server: , request: "GET /test1.do HTTP/1.1", upstream: "http://172.25.69.182:8080/test1.do", host: "172.25.71.28:9080"`
   
   `2021/04/21 21:54:00 [warn] 73450#73450: *3017774 [lua] healthcheck.lua:1142: log(): [healthcheck] (upstream#/apisix/routes/route_2050210843) unhealthy HTTP increment (2/5) for '172.25.69.182(172.25.69.182:8080)' while logging request, client: 10.58.50.104, server: , request: "GET /test1.do HTTP/1.1", upstream: "http://172.25.69.182:8080/test1.do", host: "172.25.71.28:9080"`
   
   `2021/04/21 21:54:00 [warn] 73450#73450: *3017774 [lua] healthcheck.lua:1142: log(): [healthcheck] (upstream#/apisix/routes/route_2050210843) unhealthy HTTP increment (3/5) for '172.25.69.182(172.25.69.182:8080)' while logging request, client: 10.58.50.104, server: , request: "GET /test1.do HTTP/1.1", upstream: "http://172.25.69.182:8080/test1.do", host: "172.25.71.28:9080"`
   
   ### What's the expected result?
   One request with unnormal upstream will cause only once unhealthy HTTP increment.
   I cannot understand why it has to be double loop in function `healcheck_passive` of apisix/init.lua
   
   ```
   for i, status in ipairs(http_statuses) do
           for i, status in ipairs(http_statuses) do
               if resp_status == status then
                   checker:report_http_status(api_ctx.balancer_ip,
                                              port or api_ctx.balancer_port,
                                              host,
                                              resp_status)
               end
           end
       end
   ```
   


-- 
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.

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



[GitHub] [apisix] Ben0625 edited a comment on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
Ben0625 edited a comment on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-825336030


   > @Ben0625
   > Would you submit a fix for it? Thanks!
   
   I'm sorry I'm not familiar with Github operations. I don't know how to submit a fix... Thanks for reply.


-- 
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.

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



[GitHub] [apisix] spacewander commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-825315877


   @Ben0625 
   Would you submit a fix for it? Thanks!


-- 
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.

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



[GitHub] [apisix] Ben0625 commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
Ben0625 commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-825336030


   > @Ben0625
   > Would you submit a fix for it? Thanks!
   
   I'm sorry I'm not familiar with Github operations. I don't know how to submit a fix...


-- 
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.

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



[GitHub] [apisix] spacewander closed issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4103:
URL: https://github.com/apache/apisix/issues/4103


   


-- 
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.

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



[GitHub] [apisix] spacewander commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-824462530


   CC @membphis 
   Is there special meaning for the double loop?


-- 
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.

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



[GitHub] [apisix] Ben0625 commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
Ben0625 commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-825369833


   > You can follow the guide: https://github.com/firstcontributions/first-contributions
   > Feel free to ask me if you need any helps.
   
   Thanks for pointing out the guide which help me create a pull request for the first time!


-- 
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.

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



[GitHub] [apisix] spacewander commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-825355458


   You can follow the guide: https://github.com/firstcontributions/first-contributions
   Feel free to ask me if you need any helps. 


-- 
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.

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



[GitHub] [apisix] spacewander closed issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4103:
URL: https://github.com/apache/apisix/issues/4103


   


-- 
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.

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



[GitHub] [apisix] membphis commented on issue #4103: bug: Multiple unhealthy HTTP increment if the size of passive.unhealthy.http_statuses is more than 1

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #4103:
URL: https://github.com/apache/apisix/issues/4103#issuecomment-824902753


   It is wrong, only one loop is needed here. 


-- 
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.

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