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: healthcheck to targets stopped after update upstream #78

Conversation

mrpk1906
Copy link

Hi,

As I reported in the issue Kong/kong#7652

When I updated an upstream, healthcheck to targets of this upstream has been stopped.

The bug is by using weak table and ipairs
So, when I updated an upstream, Kong insert a new object contain upstream information to hcs table
When Lua GC removed old object of the upstream => loop with ipairs stopped when got first nil => any upstream object after nil value not will be checked

-- checker objects (weak) table
local hcs = setmetatable({}, {
    __mode = "v",
})

...

for _, checker_obj in ipairs(hcs) do

@CLAassistant
Copy link

CLAassistant commented Aug 11, 2021

CLA assistant check
All committers have signed the CLA.

@kayano
Copy link
Contributor

kayano commented Nov 3, 2021

@Tieske any chance you can take a look, fix seems to be working in my case where we add/delete targets for upstreams and we experience issue with active health checks being disabled.

@gbulanov
Copy link

gbulanov commented Feb 4, 2022

When this PR will be merged ? We are hitting severe production issues due to active healthchecks being disabled when we update the upstream.

Is this fix safe to apply ?

@locao locao changed the base branch from release/1.4.2 to release/1.4.x March 30, 2022 20:11
@locao locao changed the base branch from release/1.4.x to release/1.4.2 March 30, 2022 20:34
@locao
Copy link
Contributor

locao commented Mar 31, 2022

Hi @mrpk1906! Thanks for your contribution and sorry for the delay on checking this.

This PR needed to be rebased, I did it in #100 and I'm closing this one.

@locao locao closed this Mar 31, 2022
@ankujuniyal
Copy link

Hi @locao, I don't see PR changes requested by @mrpk1906 on release/1.4.2.
it's still.
for _, checker_obj in ipairs(hcs) do

https://github.com/Kong/lua-resty-healthcheck/blob/1.4.2/lib/resty/healthcheck.lua#L1481
Also I am getting same on Kong gateway lua rock lib for health check. Even installation of new kong 2.8.X

@locao
Copy link
Contributor

locao commented Apr 14, 2023

Hi @ankujuniyal,

The fix submitted by @mrpk1906 was released in lua-resty-healthcheck 1.4.3.

For the 1.5.x series, the fix was released in lua-resty-healthcheck 1.5.1, and Kong uses it since Kong 2.8.1.

If you are using Kong 2.7.2, or any release >= 2.8.1, you should have this fix included. If you have any difficulty installing Kong, please open a discussion in its repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants