Skip to content

healthcheck: Fix goroutine leak on update/delete healthcheck

Vgutierrez requested to merge fix-hcmonitor-goroutine-leak into main

While updating or removing a realserver from hcmonitor, we stopped the healthchecks as expected but the goroutine responsible for stopping it would end up in an infinite loop munching CPU indifinitely.

With the patch applied, goroutine gets stopped as expected:

time=2024-07-15T17:33:41.655+02:00 level=DEBUG msg="new healthcheck result" healthcheck=IdleTCPConnectionCheck mark=1702428271 successful=false
time=2024-07-15T17:33:41.655+02:00 level=DEBUG msg="new healthcheck result" healthcheck=IdleTCPConnectionCheck mark=2393371824 successful=false
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="updating worker" mark=1702428271
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="stopping healthcheck goroutine" mark=1702428271
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="healthcheck goroutine stopped" mark=1702428271
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="updating worker" mark=2393371824
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="stopping healthcheck goroutine" mark=2393371824
time=2024-07-15T17:33:41.890+02:00 level=DEBUG msg="healthcheck goroutine stopped" mark=2393371824
time=2024-07-15T17:33:42.890+02:00 level=DEBUG msg="new healthcheck result" healthcheck=IdleTCPConnectionCheck mark=1702428271 successful=false
time=2024-07-15T17:33:42.890+02:00 level=DEBUG msg="new healthcheck result" healthcheck=IdleTCPConnectionCheck mark=2393371824 successful=false

This MR ships the commits from !36 (merged), !37 (merged) and !38 (merged)

Merge request reports