diff --git a/CHANGELOG.md b/CHANGELOG.md index ce5f1d01726b..b5c54b45db08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ title: Changelog ## Table of Contents +- [3.6.1](#361) - [3.6.0](#360) - [3.5.0](#350) - [3.4.0](#340) @@ -73,6 +74,14 @@ title: Changelog - [0.7.0](#070) - [0.6.0](#060) +## 3.6.1 + +### Bugfixes + +- fix: keep healthcheck target state when upstream changes: + - [#10307](https://github.com/apache/apisix/pull/10307) + - [#10312](https://github.com/apache/apisix/pull/10312) + ## 3.6.0 ### Change diff --git a/apisix/core/config_util.lua b/apisix/core/config_util.lua index 7e57ed402fd8..7313e0116ad2 100644 --- a/apisix/core/config_util.lua +++ b/apisix/core/config_util.lua @@ -114,7 +114,7 @@ function _M.fire_all_clean_handlers(item) clean_handler.f(item) end - item.clean_handlers = nil + item.clean_handlers = {} end diff --git a/apisix/core/version.lua b/apisix/core/version.lua index ff16402d38b4..9165886e6b4d 100644 --- a/apisix/core/version.lua +++ b/apisix/core/version.lua @@ -20,5 +20,5 @@ -- @module core.version return { - VERSION = "3.6.0" + VERSION = "3.6.1" } diff --git a/apisix/upstream.lua b/apisix/upstream.lua index 0ff82fea856a..d8e3f3a98750 100644 --- a/apisix/upstream.lua +++ b/apisix/upstream.lua @@ -83,7 +83,7 @@ _M.set = set_directly local function release_checker(healthcheck_parent) local checker = healthcheck_parent.checker core.log.info("try to release checker: ", tostring(checker)) - checker:clear() + checker:delayed_clear(3) checker:stop() end diff --git a/docs/en/latest/building-apisix.md b/docs/en/latest/building-apisix.md index e4804eac4ed4..8f1d26956878 100644 --- a/docs/en/latest/building-apisix.md +++ b/docs/en/latest/building-apisix.md @@ -54,7 +54,7 @@ curl https://raw.githubusercontent.com/apache/apisix/master/utils/install-depend Save the APISIX version to an environment variable to be used next: ```shell -APISIX_VERSION='3.6.0' +APISIX_VERSION='3.6.1' ``` Clone the APISIX source code of this version into a new directory `apisix-APISIX_VERSION`: diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json index e1c8391f275b..3ada4db430df 100644 --- a/docs/en/latest/config.json +++ b/docs/en/latest/config.json @@ -1,5 +1,5 @@ { - "version": "3.6.0", + "version": "3.6.1", "sidebar": [ { "type": "category", diff --git a/docs/zh/latest/CHANGELOG.md b/docs/zh/latest/CHANGELOG.md index a3ce74cca888..06c4cd3b9f03 100644 --- a/docs/zh/latest/CHANGELOG.md +++ b/docs/zh/latest/CHANGELOG.md @@ -23,6 +23,7 @@ title: CHANGELOG ## Table of Contents +- [3.6.1](#361) - [3.6.0](#360) - [3.5.0](#350) - [3.4.0](#340) @@ -73,6 +74,14 @@ title: CHANGELOG - [0.7.0](#070) - [0.6.0](#060) +## 3.6.1 + +### Bugfix + +- 修复:当上游发生变化时保持健康检查目标状态: + - [#10312](https://github.com/apache/apisix/pull/10312) + - [#10307](https://github.com/apache/apisix/pull/10307) + ## 3.6.0 ### Change diff --git a/docs/zh/latest/building-apisix.md b/docs/zh/latest/building-apisix.md index abeac2033c68..7da870acdd29 100644 --- a/docs/zh/latest/building-apisix.md +++ b/docs/zh/latest/building-apisix.md @@ -53,7 +53,7 @@ curl https://raw.githubusercontent.com/apache/apisix/master/utils/install-depend 然后,创建一个目录并设置环境变量 `APISIX_VERSION`: ```shell -APISIX_VERSION='3.6.0' +APISIX_VERSION='3.6.1' mkdir apisix-${APISIX_VERSION} ``` diff --git a/docs/zh/latest/config.json b/docs/zh/latest/config.json index 1ff81e6b64d1..8990b01ef739 100644 --- a/docs/zh/latest/config.json +++ b/docs/zh/latest/config.json @@ -1,5 +1,5 @@ { - "version": "3.6.0", + "version": "3.6.1", "sidebar": [ { "type": "category", diff --git a/rockspec/apisix-3.6.1-0.rockspec b/rockspec/apisix-3.6.1-0.rockspec new file mode 100644 index 000000000000..3609410794c3 --- /dev/null +++ b/rockspec/apisix-3.6.1-0.rockspec @@ -0,0 +1,104 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +package = "apisix" +version = "3.6.1-0" +supported_platforms = {"linux", "macosx"} + +source = { + url = "git://github.com/apache/apisix", + branch = "3.6.1", +} + +description = { + summary = "Apache APISIX is a cloud-native microservices API gateway, delivering the ultimate performance, security, open source and scalable platform for all your APIs and microservices.", + homepage = "https://github.com/apache/apisix", + license = "Apache License 2.0", +} + +dependencies = { + "lua-resty-ctxdump = 0.1-0", + "api7-lua-resty-dns-client = 7.0.1", + "lua-resty-template = 2.0", + "lua-resty-etcd = 1.10.5", + "api7-lua-resty-http = 0.2.2-0", + "lua-resty-balancer = 0.04", + "lua-resty-ngxvar = 0.5.2", + "lua-resty-jit-uuid = 0.0.7", + "lua-resty-worker-events = 1.0.0", + "lua-resty-healthcheck-api7 = 3.2.0", + "api7-lua-resty-jwt = 0.2.5", + "lua-resty-hmac-ffi = 0.06-1", + "lua-resty-cookie = 0.2.0-1", + "lua-resty-session = 3.10", + "opentracing-openresty = 0.1", + "lua-resty-radixtree = 2.8.2", + "lua-protobuf = 0.5.0-1", + "lua-resty-openidc = 1.7.6-3", + "luafilesystem = 1.7.0-2", + "api7-lua-tinyyaml = 0.4.4", + "nginx-lua-prometheus = 0.20230607-1", + "jsonschema = 0.9.8", + "lua-resty-ipmatcher = 0.6.1", + "lua-resty-kafka = 0.22-0", + "lua-resty-logger-socket = 2.0.1-0", + "skywalking-nginx-lua = 0.6.0", + "base64 = 1.5-2", + "binaryheap = 0.4", + "api7-dkjson = 0.1.1", + "resty-redis-cluster = 1.05-1", + "lua-resty-expr = 1.3.2", + "graphql = 0.0.2", + "argparse = 0.7.1-1", + "luasocket = 3.1.0-1", + "luasec = 0.9-1", + "lua-resty-consul = 0.3-2", + "penlight = 1.13.1", + "ext-plugin-proto = 0.6.1", + "casbin = 1.41.8-1", + "inspect == 3.1.1", + "lualdap = 1.2.6-1", + "lua-resty-rocketmq = 0.3.0-0", + "opentelemetry-lua = 0.2-3", + "net-url = 0.9-1", + "xml2lua = 1.5-2", + "nanoid = 0.1-1", + "lua-resty-mediador = 0.1.2-1", + "lua-resty-ldap = 0.1.0-0", + "lua-resty-t1k = 1.1.0" +} + +build = { + type = "make", + build_variables = { + CFLAGS="$(CFLAGS)", + LIBFLAG="$(LIBFLAG)", + LUA_LIBDIR="$(LUA_LIBDIR)", + LUA_BINDIR="$(LUA_BINDIR)", + LUA_INCDIR="$(LUA_INCDIR)", + LUA="$(LUA)", + OPENSSL_INCDIR="$(OPENSSL_INCDIR)", + OPENSSL_LIBDIR="$(OPENSSL_LIBDIR)", + }, + install_variables = { + ENV_INST_PREFIX="$(PREFIX)", + ENV_INST_BINDIR="$(BINDIR)", + ENV_INST_LIBDIR="$(LIBDIR)", + ENV_INST_LUADIR="$(LUADIR)", + ENV_INST_CONFDIR="$(CONFDIR)", + }, +} diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index ec99128f30f3..d4e4b71a0db5 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -39,7 +39,8 @@ dependencies = { "lua-resty-balancer = 0.04", "lua-resty-ngxvar = 0.5.2", "lua-resty-jit-uuid = 0.0.7", - "lua-resty-healthcheck-api7 = 3.0.0", + "lua-resty-worker-events = 1.0.0", + "lua-resty-healthcheck-api7 = 3.2.0", "api7-lua-resty-jwt = 0.2.5", "lua-resty-hmac-ffi = 0.06-1", "lua-resty-cookie = 0.2.0-1", diff --git a/t/control/healthcheck.t b/t/control/healthcheck.t index 5d40e970739b..9673ab917ba5 100644 --- a/t/control/healthcheck.t +++ b/t/control/healthcheck.t @@ -51,7 +51,7 @@ routes: upstreams: - nodes: "127.0.0.1:1980": 1 - "127.0.0.2:1988": 1 + "127.0.0.2:1988": 0 type: roundrobin id: 1 checks: @@ -120,11 +120,11 @@ upstreams: --- grep_error_log eval qr/unhealthy TCP increment \(.+\) for '[^']+'/ --- grep_error_log_out -unhealthy TCP increment (1/2) for '(127.0.0.2:1988)' -unhealthy TCP increment (2/2) for '(127.0.0.2:1988)' +unhealthy TCP increment (1/2) for '127.0.0.2(127.0.0.2:1988)' +unhealthy TCP increment (2/2) for '127.0.0.2(127.0.0.2:1988)' --- response_body -[{"counter":{"http_failure":0,"success":0,"tcp_failure":0,"timeout_failure":0},"ip":"127.0.0.1","port":1980,"status":"healthy"},{"counter":{"http_failure":0,"success":0,"tcp_failure":2,"timeout_failure":0},"ip":"127.0.0.2","port":1988,"status":"unhealthy"}] -[{"counter":{"http_failure":0,"success":0,"tcp_failure":0,"timeout_failure":0},"ip":"127.0.0.1","port":1980,"status":"healthy"},{"counter":{"http_failure":0,"success":0,"tcp_failure":2,"timeout_failure":0},"ip":"127.0.0.2","port":1988,"status":"unhealthy"}] +[{"counter":{"http_failure":0,"success":0,"tcp_failure":0,"timeout_failure":0},"hostname":"127.0.0.1","ip":"127.0.0.1","port":1980,"status":"healthy"},{"counter":{"http_failure":0,"success":0,"tcp_failure":2,"timeout_failure":0},"hostname":"127.0.0.2","ip":"127.0.0.2","port":1988,"status":"unhealthy"}] +[{"counter":{"http_failure":0,"success":0,"tcp_failure":0,"timeout_failure":0},"hostname":"127.0.0.1","ip":"127.0.0.1","port":1980,"status":"healthy"},{"counter":{"http_failure":0,"success":0,"tcp_failure":2,"timeout_failure":0},"hostname":"127.0.0.2","ip":"127.0.0.2","port":1988,"status":"unhealthy"}] diff --git a/t/discovery/consul.t b/t/discovery/consul.t index 57a6ab5b4fbd..ae1e10769948 100644 --- a/t/discovery/consul.t +++ b/t/discovery/consul.t @@ -579,8 +579,8 @@ upstreams: --- request GET /thc --- response_body -[{"ip":"127.0.0.1","port":30513,"status":"healthy"},{"ip":"127.0.0.1","port":30514,"status":"healthy"}] -[{"ip":"127.0.0.1","port":30513,"status":"healthy"},{"ip":"127.0.0.1","port":30514,"status":"healthy"}] +[{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30513,"status":"healthy"},{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30514,"status":"healthy"}] +[{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30513,"status":"healthy"},{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30514,"status":"healthy"}] --- ignore_error_log diff --git a/t/discovery/consul_kv.t b/t/discovery/consul_kv.t index 9363f768d209..072925cd1a0f 100644 --- a/t/discovery/consul_kv.t +++ b/t/discovery/consul_kv.t @@ -450,8 +450,8 @@ upstreams: --- request GET /thc --- response_body -[{"ip":"127.0.0.1","port":30511,"status":"healthy"},{"ip":"127.0.0.2","port":1988,"status":"unhealthy"}] -[{"ip":"127.0.0.1","port":30511,"status":"healthy"},{"ip":"127.0.0.2","port":1988,"status":"unhealthy"}] +[{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30511,"status":"healthy"},{"hostname":"127.0.0.2","ip":"127.0.0.2","port":1988,"status":"unhealthy"}] +[{"hostname":"127.0.0.1","ip":"127.0.0.1","port":30511,"status":"healthy"},{"hostname":"127.0.0.2","ip":"127.0.0.2","port":1988,"status":"unhealthy"}] --- ignore_error_log diff --git a/t/node/healthcheck-discovery.t b/t/node/healthcheck-discovery.t index c8cf99b6c1dc..e8e21b04240f 100644 --- a/t/node/healthcheck-discovery.t +++ b/t/node/healthcheck-discovery.t @@ -94,7 +94,7 @@ routes: local httpc = http.new() local res, err = httpc:request_uri(uri, {method = "GET", keepalive = false}) - ngx.sleep(0.5) + ngx.sleep(1.5) ngx.say(res.status) } diff --git a/t/node/healthcheck-leak-bugfix.t b/t/node/healthcheck-leak-bugfix.t index d3ada8c171f7..1caf5d348abf 100644 --- a/t/node/healthcheck-leak-bugfix.t +++ b/t/node/healthcheck-leak-bugfix.t @@ -31,8 +31,8 @@ __DATA__ local new = healthcheck.new healthcheck.new = function(...) local obj = new(...) - local clear = obj.clear - obj.clear = function(...) + local clear = obj.delayed_clear + obj.delayed_clear = function(...) ngx.log(ngx.WARN, "clear checker") return clear(...) end diff --git a/t/node/healthcheck.t b/t/node/healthcheck.t index 0ae4fbdb9d85..3053a0bb713f 100644 --- a/t/node/healthcheck.t +++ b/t/node/healthcheck.t @@ -486,6 +486,7 @@ qr{\[error\].*while connecting to upstream.*} qr{.*http://127.0.0.1:1960/server_port.* .*http://127.0.0.1:1961/server_port.* .*http://127.0.0.1:1961/server_port.* +.*http://127.0.0.1:1960/server_port.* .*http://127.0.0.1:1961/server_port.* .*http://127.0.0.1:1961/server_port.*} --- timeout: 10 diff --git a/t/node/priority-balancer/health-checker.t b/t/node/priority-balancer/health-checker.t index fb65e3fd2355..7ad685ac86bb 100644 --- a/t/node/priority-balancer/health-checker.t +++ b/t/node/priority-balancer/health-checker.t @@ -102,8 +102,8 @@ upstreams: GET /t --- error_log connect() failed -unhealthy TCP increment (2/2) for '(127.0.0.1:1979) -unhealthy TCP increment (2/2) for '(127.0.0.2:1979) +unhealthy TCP increment (2/2) for '127.0.0.1(127.0.0.1:1979) +unhealthy TCP increment (2/2) for '127.0.0.2(127.0.0.2:1979) --- grep_error_log eval qr/proxy request to \S+/ --- grep_error_log_out @@ -177,7 +177,7 @@ passed GET /t --- error_log connect() failed -unhealthy TCP increment (2/2) for '(127.0.0.1:1979) +unhealthy TCP increment (2/2) for '127.0.0.1(127.0.0.1:1979) --- grep_error_log eval qr/proxy request to \S+/ --- grep_error_log_out