Skip to content

Commit

Permalink
fix: etcd watch restart when receive invalid revision (#11833)
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup authored Dec 18, 2024
1 parent 44391e0 commit 844b396
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 844b396

Please sign in to comment.