spring-cloud / spring-cloud/spring-cloud-netflix

Health indicator for Eureka client reports UP when not connected to server

Open Beginner friendly
#4,562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
5k
Forks
2.5k
Avg merge
1d 2h
Merged PRs (30d)
10

Description

Describe the bug
If Eureka server is not available, Health indicator for Eureka client will always report that it is UP. One such sample from Spring Cloud Gateway:

{
  "status": "DOWN",
  "components": {
    "discoveryComposite": {
      "status": "UP",
      "components": {
        "discoveryClient": {
          "status": "UP",
          "details": {
            "services": []
          }
        },
        "eureka": {
          "description": "Eureka discovery client has not yet successfully connected to a Eureka server",
          "status": "UP",
          "details": {
            "applications": {

            }
          }
        }
      }
    },
    "reactiveDiscoveryClients": {
      "status": "UP",
      "components": {
        "Simple Reactive Discovery Client": {
          "status": "UP",
          "details": {
            "services": []
          }
        },
        "Spring Cloud Eureka Reactive Discovery Client": {
          "status": "UP",
          "details": {
            "services": []
          }
        }
      }
    },
    "redis": {
      "status": "DOWN",
      "details": {
        "error": "org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis"
      }
    },
  }
}

These are the lines which specifically say that Health indicator should report UP: https://github.com/spring-cloud/spring-cloud-netflix/blob/b6353637c97e3044967ae44bda5c3377b63a4ee1/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java#L76-L77 and https://github.com/spring-cloud/spring-cloud-netflix/blob/b6353637c97e3044967ae44bda5c3377b63a4ee1/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java#L80-L81

Not sure why it was done this way, but I don't think this is right. If Eureka client cannot connect to Eureka server the application should report as DOWN at least for readiness probe.

Sample
Just take standard Spring Cloud Gateway application, add Spring Cloud Netflix Client dependency to it, and start the gateway. For visibility add:

management.endpoints.web.exposure.include=health
management.endpoint.health.show-details=always

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java, especially the lines linked in the issue. Reproduce the behavior with a standard Spring Cloud Gateway application and the listed health settings while Eureka is unavailable. Done means the Eureka health indicator reports DOWN when it has not connected to a Eureka server.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.