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

Eureka Causes Health Indicator to Fail When Disabled #2037

Closed
michaeljmcd opened this issue Aug 23, 2019 · 6 comments
Closed

Eureka Causes Health Indicator to Fail When Disabled #2037

michaeljmcd opened this issue Aug 23, 2019 · 6 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@michaeljmcd
Copy link

I have an app where I am using Spring Cloud Config, but not Eureka. Health endpoints are also enabled, but when I hit /health the application always shows as DOWN, where the only issue at play is that the health check cannot connect to Eureka. It doesn't seem like the Eureka client should affect

Steps to Reproduce

  1. Build and run an app with both cloud config and management endpoints enabled (see example below), but Eureka disabled.
  2. Check the /health endpoint.

Expected Behaviour

/health should report service as UP because no enabled dependencies fail.

Actual Behaviour

/health endpoint returns a status of DOWN and the following stack trace is shown in stdout.

16:16:50.648 [nioEventLoopGroup-1-5] ERROR i.m.m.health.indicator.HealthResult - Health indicator [eureka] reported exception: io.micronaut.http.client.exceptions.HttpClientException: Connect error:Connection re
fused: localhost/127.0.0.1:8761                                                                                                                                                                                   
io.micronaut.http.client.exceptions.HttpClientException: Connect error:Connection refused: localhost/127.0.0.1:8761                                                                                                
        at io.micronaut.http.client.DefaultHttpClient.lambda$null$21(DefaultHttpClient.java:955)                                                                                                                  
        at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)                                                                                                                        
        at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:504)                                                                                                                       
        at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:483)                                                                                                                     
        at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)                                                                                                                        
        at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:121)                                                                                                                            
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:327)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:343)                                                                                                    
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:632)                                                                                                                            
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)                                                                                                                   
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)                                                                                                                           
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
        at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:53)
        at io.micronaut.http.context.ServerRequestContext.lambda$instrument$0(ServerRequestContext.java:69)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:834)                 
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:8761
        at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)        
        at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779)
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327)                                                                                                                 
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)                                                                                                   
        ... 9 common frames omitted                                         
Caused by: java.net.ConnectException: Connection refused                                                                                                                                                           
        ... 13 common frames omitted                                                            

Environment Information

  • Operating System: Linux hostname 4.4.0-17763-Microsoft Please give me websocket example #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu running under Windows 10 WSL).
  • Micronaut Version: 1.1.1, 1.0.5 (reproduced in both versions).
  • JDK Version: OpenJDK 11.0.1

Example Application

A minimal sample app is available at https://github.com/michaeljmcd/eureka-health-issue

@jameskleeh
Copy link
Contributor

Can you verify this is an issue in 1.2.0 ?

@michaeljmcd
Copy link
Author

Yes, the same thing plays out after upgrading to 1.2.0. I've pushed an update the sample app, upgrading it to 1.2.0.

@jameskleeh jameskleeh added status: awaiting validation Waiting to be validated as a real issue and removed status: awaiting feedback labels Sep 12, 2019
@jameskleeh
Copy link
Contributor

@michaeljmcd So there are a couple factors here:

endpoints.health.discovery-client.enabled: false will disable the health indicator for the discovery client

There is also a EurekaHealthIndicator which relies on the existence of a EurekaClient. The EurekaClient uses @RequiresEureka which simply requires the eureka.client property to be set in config, which is the case.

@jameskleeh
Copy link
Contributor

So while it's clear in your case that the client should not be enabled because both discovery and registration are disabled, I don't know what the behavior should be if only one of the two are disabled.

@graemerocher
Copy link
Contributor

If either are enabled I imagine there should be a health check

@jameskleeh jameskleeh added status: under consideration The issue is being considered, but has not been accepted yet and removed status: awaiting validation Waiting to be validated as a real issue labels Sep 12, 2019
@jameskleeh
Copy link
Contributor

OK - I'll update the @RequiresEureka to check for either property being true, respecting defaults.

@jameskleeh jameskleeh self-assigned this Sep 12, 2019
@jameskleeh jameskleeh added type: bug Something isn't working and removed status: under consideration The issue is being considered, but has not been accepted yet labels Sep 12, 2019
@jameskleeh jameskleeh added this to the 1.2.2 milestone Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants