-
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
chore: catch error while new healthcheck
instance
#3213
Conversation
@@ -87,12 +87,17 @@ local function create_checker(upstream, healthcheck_parent) | |||
if healthcheck == nil then | |||
healthcheck = require("resty.healthcheck") | |||
end | |||
local checker = healthcheck.new({ | |||
local checker, err = healthcheck.new({ |
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.
Is it possible to write a test for it?
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.
I remember that error happened when more workers tried to create checkers at the same moment. In the PROD, I have encountered such problems. I will consider how to add test cases, but I think it's a bit difficult :(
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.
OK
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.
I can't find a way to reproduce it by using Test::Nginx. In my test case, I've set master_on,workers(10) and added a server on different port, I create many threads to connect that server when got the initial request, and wanted the different workers would handled that connections, but only the same worker which got the initial request dealt with the connection requests.
@membphis @spacewander Do you have a way to get test requests on different workers?
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.
AFAIK, there is no such a way.
What this PR does / why we need it:
catch error while new
healthcheck
instance and return the checker with nil.the function pick_server will treat the nodes as normal with the 'checker == nil', and get a correct one by rules.
fix #3169
Pre-submission checklist: