Passive healthcheck bug

file: resty/healthcheck.lua
function: incr_counter

description:
The bug code is there:
if (health_mode == “healthy” and target.healthy) or
(health_mode == “unhealthy” and not target.healthy) then
– No need to count successes when healthy or failures when unhealthy
return true
end

When I config passive healthcheck without active healthcheck. If the failures counter of a target is not null and it’s current status is heathy, then this bug results that the success request can’t clean the failure counter。

I had resove this bug in this way:

local nokCounter = self.shm:get(get_shm_key(self.TARGET_NOKS, ip, port));
if (health_mode == “healthy” and target.healthy and (not nokCounter or nokCounter == 0)) or
(health_mode == “unhealthy” and not target.healthy) then
– No need to count successes when healthy or failures when unhealthy
return true
end

@wuguangkuo Hi,

If you believe you have encountered a bug, would you please open an issue on the GitHub repository? If you have a patch to fix it, we would most certainly welcome a Pull Request as well!

We have a quick guide on how to submit a patch, and keep in mind you can your contributor T-shirt this way :slight_smile:

Best,

OK,I had commit the path at Kong/lua-resty-healthcheck project

1 Like

Hi, I commit the pull request at here: https://github.com/Kong/lua-resty-healthcheck/pull/8,
but there is no one to deal it.

@wuguangkuo Give it some time. @hisham will be looking at it tomorrow :slight_smile: Thanks

We have solved this in the Github issue tracker, but for future reference in this forum, this has been fixed in lua-resty-healthcheck 0.4.1 (luarocks install lua-resty-healthcheck). Thanks for reporting!

1 Like