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

Healthcheck stopped after update Upstream #7652

Closed
mrpk1906 opened this issue Aug 3, 2021 · 13 comments
Closed

Healthcheck stopped after update Upstream #7652

mrpk1906 opened this issue Aug 3, 2021 · 13 comments

Comments

@mrpk1906
Copy link

mrpk1906 commented Aug 3, 2021

Summary

  • Kong version 2.5.0
  1. I have an upstream with 5 targets, 4/5 are unhealthy. When I removed 1 unhealthy target then Kong changed all targets status to HEALTHY
  2. When I updated upstream, Kong changed all targets status to HEALTHY and healthcheck stopped too

Upstream information

{
  "tags": null,
  "hash_on_cookie": null,
  "hash_on_cookie_path": "/",
  "hash_fallback": "none",
  "hash_fallback_header": null,
  "algorithm": "round-robin",
  "created_at": 1565666630,
  "client_certificate": null,
  "healthchecks": {
    "passive": {
      "type": "http",
      "unhealthy": {
        "http_statuses": [
          429,
          500,
          503
        ],
        "tcp_failures": 0,
        "timeouts": 0,
        "http_failures": 0
      },
      "healthy": {
        "http_statuses": [
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          226,
          300,
          301,
          302,
          303,
          304,
          305,
          306,
          307,
          308
        ],
        "successes": 0
      }
    },
    "threshold": 0,
    "active": {
      "concurrency": 1,
      "https_verify_certificate": true,
      "type": "http",
      "healthy": {
        "successes": 2,
        "http_statuses": [
          200,
          302,
          400
        ],
        "interval": 5
      },
      "unhealthy": {
        "interval": 5,
        "timeouts": 5,
        "tcp_failures": 2,
        "http_statuses": [
          429,
          404,
          500,
          501,
          502,
          503,
          504,
          505
        ],
        "http_failures": 5
      },
      "timeout": 1,
      "http_path": "/",
      "https_sni": null
    }
  },
  "slots": 10000,
  "hash_on_header": null,
  "hash_on": "none",
  "name": "permission-dev",
  "id": "9dd55a0c-b1be-4c88-96aa-63375527da44",
  "host_header": null
}

Kong debug log

Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] init.lua:233: process_event(): [cluster_events] new event (channel: 'balancer:upstreams') data: 'update:9dd55a0c-b1be-4c88-96aa-63375527da44:permission-dev' nbf: '1628009167.41' shm exptime: 12
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) healthchecker stopped
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:1495: new(): [upstream:permission-dev 216] balancer_base created
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] round_robin.lua:165: new(): [upstream:permission-dev 216] round_robin balancer created
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.69
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.69
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.69, nil -> 1
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.69' created: 172.26.3.69:9898 (weight 100)
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.69
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.69 completed
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.63
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.63
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.63, nil -> 1
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.63' created: 172.26.3.63:9898 (weight 100)
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.63
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.63 completed
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.66
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.66
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.66, nil -> 1
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.66' created: 172.26.3.66:9898 (weight 100)
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.66
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.66 completed
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.115
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.115
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.115, nil -> 1
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.115' created: 172.26.3.115:9898 (weight 100)
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.115
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.115 completed
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) Got initial target list (0 targets)
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) active check flagged as active
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) starting timer to check active checks
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) Healthchecker started!
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=clear, pid=3719110, data=table: 0x7f3c66569198
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: local cache cleared
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=healthy, pid=3719110, data=table: 0x7f3c66569720
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target added '172.26.3.69(172.26.3.69:9898)'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target status '172.26.3.69(172.26.3.69:9898)' from 'false' to 'true'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=healthy, pid=3719110, data=table: 0x7f3c6656a650
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target added '172.26.3.63(172.26.3.63:9898)'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target status '172.26.3.63(172.26.3.63:9898)' from 'false' to 'true'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=healthy, pid=3719110, data=table: 0x7f3c6656ace8
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target added '172.26.3.66(172.26.3.66:9898)'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target status '172.26.3.66(172.26.3.66:9898)' from 'false' to 'true'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=healthy, pid=3719110, data=table: 0x7f3c6656b4b0
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target added '172.26.3.115(172.26.3.115:9898)'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719110#0: *137832 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: target status '172.26.3.115(172.26.3.115:9898)' from 'false' to 'true'
Aug  3 23:46:09 kong-prod-12 kong: 2021/08/03 23:46:09 [debug] 3719111#0: *137906 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) healthchecker stopped
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719104#0: *137908 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) healthchecker stopped
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719115#0: *137913 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) healthchecker stopped
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719107#0: *137929 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) healthchecker stopped
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:1495: new(): [upstream:permission-dev 216] balancer_base created
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] round_robin.lua:165: new(): [upstream:permission-dev 216] round_robin balancer created
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719107#0: *137929 [lua] base.lua:1495: new(): [upstream:permission-dev 216] balancer_base created
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719107#0: *137929 [lua] round_robin.lua:165: new(): [upstream:permission-dev 216] round_robin balancer created
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.69
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.69
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.69, nil -> 1
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.69' created: 172.26.3.69:9898 (weight 100)
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.69
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.69 completed
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.63
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.63
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.63, nil -> 1
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.63' created: 172.26.3.63:9898 (weight 100)
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.63
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.63 completed
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.66
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.66
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.66, nil -> 1
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.66' created: 172.26.3.66:9898 (weight 100)
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.66
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.66 completed
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:909: newHost(): [upstream:permission-dev 216] created a new host for: 172.26.3.115
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:647: queryDns(): [upstream:permission-dev 216] querying dns for 172.26.3.115
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:562: f(): [upstream:permission-dev 216] dns record type changed for 172.26.3.115, nil -> 1
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:368: newAddress(): [upstream:permission-dev 216] new address for host '172.26.3.115' created: 172.26.3.115:9898 (weight 100)
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:626: f(): [upstream:permission-dev 216] updating balancer based on dns changes for 172.26.3.115
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] base.lua:636: f(): [upstream:permission-dev 216] querying dns and updating for 172.26.3.115 completed
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) Got initial target list (0 targets)
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) active check flagged as active
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) Healthchecker started!
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=clear, pid=3719110, data=table: 0x7f3c6570d9a0
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] healthcheck.lua:1126: log(): [healthcheck] (5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev) event: local cache cleared
Aug  3 23:46:10 kong-prod-12 kong: 2021/08/03 23:46:10 [debug] 3719111#0: *137906 [lua] events.lua:211: do_event_json(): worker-events: handling event; source=lua-resty-healthcheck [5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev], event=healthy, pid=3719110, data=table: 0x7f3c6570dd08
@mrpk1906
Copy link
Author

mrpk1906 commented Aug 7, 2021

Hi,

I tried to debug the issue, I put a print in for loop block in file healthcheck.lua following below

...
              self:renew_periodic_lock()
              local cur_time = ngx_now()
              for _, checker_obj in ipairs(hcs) do
                if checker_obj.name == "5fb68818-d502-41ae-abcc-a41ff1405783:permission-dev" then
                  print("found permission-dev")
                end
                if checker_obj.checks.active.healthy.active and
                  (checker_obj.checks.active.healthy.last_run +
                  checker_obj.checks.active.healthy.interval <= cur_time)
                then
...

I updated upstream permission-dev 2-continuously times then check log file, I got the message found permission-dev showed in several minutes and stopped

Conclusion

  • I think issue is in hcs (weak table)
  • I tried print length of hcs, when I update upstream twice, len of hcs increased by 2. After several minutes, len of hcs decreased to normal => no longer see the message found permission-dev => may be object of permission-dev removed by GC

@mrpk1906
Copy link
Author

mrpk1906 commented Aug 9, 2021

Hi,

After searching about pairs and ipairs, I think issue is when I update upstream, old upstream object in hcs has been removed by GC, it means we have gaps in table => iterate over hcs stopped when got nil => new upstream object inserted by table.insert(hcs, self) will never be reached

Ref: https://sodocumentation.net/lua/topic/676/tables#avoiding-gaps-in-tables-used-as-arrays

I changed from ipairs to pairs, it working well

for _, checker_obj in ipairs(hcs) do

@luguohong
Copy link

our project has the same problem!
we found that when we update target,active health check will stop,and there is no problem with passive health check.
kong version 2.5.0
we updated from 2.2.0

@luguohong
Copy link

by the way, how do i roll back kong to 2.2.0?

@luguohong
Copy link

luguohong commented Aug 24, 2021

we found a new problem. when we update target by konga, and set target unhealth or health, konga show msg:

[31merror: �[39mKongProxyController request error { message: 'Upstream serviceXXXXX has no balancer' }

@jsloring
Copy link

我们发现了一个新问题。当我们通过 konga 更新目标,并设置目标 unhealth 或 health 时,konga 显示 msg:

[31merror: [39mKongProxyController request error { message: 'Upstream serviceXXXXX has no balancer' }
我也碰到了这个问题,请问有解决这个问题的方案么

@daviddone
Copy link

mark

@PorcupineBoy
Copy link

how to fix it?

@mrpk1906
Copy link
Author

how to fix it?

@PorcupineBoy You can workaround following the pull request
Kong/lua-resty-healthcheck#78

@PorcupineBoy
Copy link

how to fix it?

@PorcupineBoy You can workaround following the pull request Kong/lua-resty-healthcheck#78

now iam using the kong version was 2.7.0.0-enterprise-edition .
how can i know which version had fixed this bug ? can u help me 。

@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 ? We are using kong 2.5.1

@kayano
Copy link

kayano commented Mar 11, 2022

I've ported the fix Kong/lua-resty-healthcheck#78 to lua-resty-healthcheck version 1.5.0 used in kong 2.8.0 here Kong/lua-resty-healthcheck#93,

There are steps In my PR description how to reproduce the issue in kong 2.8.0. I hope it helps to have it merged.

@locao
Copy link
Contributor

locao commented Mar 21, 2023

This issue was fixed thanks to @kayano. If you want to keep using Kong 2.x series, you need at least Kong 2.7.2 or 2.8.1 to have the fix included.
As the issue is fixed for newer releases and we don't support versions as old as 2.5, I'm closing this report.
Thanks for all your help.

@locao locao closed this as completed Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants