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


   ### Issue description
   When both active and passive configuration are updated from only active 
configuration, the http statuses of passive become an empty table which causes 
passive healthcheck not working. 
   
   ### 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
   1. Set a route with two upstreams(/test.do) and healthcheck active 
configuration(/check.do). 
   2. Send a request to trigger creating new checker.
   3. Update this route only by changing healthcheck configuration to both 
active and passive. Let one of the upstream return 500 code to act like a 
unnormal node. Send some requests, but the unnormal node cannot be set to be 
unhealthy even reaching the passive.unhealthy.http_failures.
   
   ### What's the actual result?
   I prints some debug info inside this function: 
https://github.com/Kong/lua-resty-healthcheck/blob/master/lib/resty/healthcheck.lua#L1372
   I prints out the "defaults" table at line 1443.
   
   After doing Step 2, the type of 
defaults.checks.passive.unhealthy.http_statuses changes from array to dict!
   
---------------------------------------------------------------------------------
   defaults.checks.passive.unhealthy.http_statuses before to_set() function:
   {
        1 = 429,
        2 = 500,
        3 = 503,
   }
   
   defaults.checks.passive.unhealthy.http_statuses after to_set() function:
   {
        429 = true,
        500 = true,
        503 = true,
   }
   
---------------------------------------------------------------------------------
   It seems that to_set() changes the "self" object, result in changing 
"defaults" as well.
   After doing Step 3, defaults.checks.passive.unhealthy.http_statuses becomes 
an empty table after to_set() function.
   
   ### What's the expected result?
   In my opinion, the "defaults" object should not be changed. Maybe there's 
some problem with fill_in_settings() function at line 1377. Or am I doing 
something wrong during these operations?


-- 
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:
[email protected]


Reply via email to