Skip to content

Commit 844b396

Browse files
authored
fix: etcd watch restart when receive invalid revision (#11833)
1 parent 44391e0 commit 844b396

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apisix/core/config_etcd.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ local function do_run_watch(premature)
257257
end
258258

259259
local rev = tonumber(res.result.header.revision)
260+
if rev == nil then
261+
log.warn("receive a invalid revision header, header: ", inspect(res.result.header))
262+
cancel_watch(http_cli)
263+
break
264+
end
260265
if rev > watch_ctx.rev then
261266
watch_ctx.rev = rev + 1
262267
end
@@ -284,7 +289,8 @@ local function run_watch(premature)
284289

285290
local ok, err = ngx_thread_wait(run_watch_th, check_worker_th)
286291
if not ok then
287-
log.error("check_worker thread terminates failed, retart checker, error: " .. err)
292+
log.error("run_watch or check_worker thread terminates failed",
293+
" restart those threads, error: ", inspect(err))
288294
end
289295

290296
ngx_thread_kill(run_watch_th)

0 commit comments

Comments
 (0)