spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.24k stars 40.7k forks source link

Liveness Probe gets All Health Groups when Using Additional Path #42159

Closed matthenry87 closed 2 months ago

matthenry87 commented 2 months ago

Replicator project: https://github.com/matthenry87/additional-liveness-path-bug

❯ curl localhost:8080/actuator/health/liveness | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   461    0   461    0     0    317      0 --:--:--  0:00:01 --:--:--   317
❯ curl localhost:8080/livez | jq   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   461    0   461    0     0     91      0 --:--:--  0:00:05 --:--:--   121

Both responses:

{
  "status": "DOWN",
  "components": {
    "diskSpace": {
      "status": "UP",
      "details": {
        "total": 994662584320,
        "free": 809366671360,
        "threshold": 10485760,
        "path": "/redacted/.",
        "exists": true
      }
    },
    "livenessState": {
      "status": "UP"
    },
    "mail": {
      "status": "DOWN",
      "details": {
        "location": "localhost:25",
        "error": "org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: localhost:25, 25; timeout -1"
      }
    },
    "ping": {
      "status": "UP"
    },
    "readinessState": {
      "status": "UP"
    }
  }
}

We discovered this when our mail server went down, and all of our pods/apps that use the mail starter started getting bounced over and over.

Our work-around is to pass this via environment to all apps:

MANAGEMENT_ENDPOINT_HEALTH_GROUP_LIVENESS_EXCLUDE db,ping,diskSpace,readinessState,mail,redis

MANAGEMENT_ENDPOINT_HEALTH_VALIDATE-GROUP-MEMBERSHIP false

wilkinsona commented 2 months ago

Duplicates #40268.