-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: etcd watch restart when receive invalid revision #11833
Conversation
apisix/core/config_etcd.lua
Outdated
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style: bad indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.error("run_watch or check_worker thread terminates failed",
" restart those threads, error: ", inspect(err))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Description
When the revision contained in the response returned by etcd watch API is empty, it will cause the watch thread to abort. Since the thread exits abnormally, the error object return from
ngx.thread.wait
is either nil or a boolean value (nil can be reproduced, but boolean cannot, I don't know why yet), causing subsequent log printing to abort too and making it impossible to restart the watch thread.Fixes # (issue)
Checklist