Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: etcd watch restart when receive invalid revision #11833

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apisix/core/config_etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ local function do_run_watch(premature)
end

local rev = tonumber(res.result.header.revision)
if rev == nil then
log.warn("receive a invalid revision header, header: ", inspect(res.result.header))
cancel_watch(http_cli)
break
end
if rev > watch_ctx.rev then
watch_ctx.rev = rev + 1
end
Expand Down Expand Up @@ -284,7 +289,8 @@ local function run_watch(premature)

local ok, err = ngx_thread_wait(run_watch_th, check_worker_th)
if not ok then
log.error("check_worker thread terminates failed, retart checker, error: " .. err)
log.error("run_watch or check_worker thread terminates failed",
" restart those threads, error: ", inspect(err))
end

ngx_thread_kill(run_watch_th)
Expand Down
Loading