Skip to content

actuator/health/grpc endpoint continue reporting grpc services as SERVING even if grpc server has been stopped #385

Open
@chetan5375

Description

@chetan5375

Steps to Reproduce

  • Create a spring boot app with lognet
  • Create any simple grpcService
  • Create a restController having a reference to GrpcServerRunner
  • Expose a rest end point in this restController to stop grpc server
  • Deploy and run app in your local kubernetes cluster (You can run as spring boot app as well, doesn't have to be deployed to cluster)
  • Tomcat and grpc server will be started. RestController and grpc services will get registered
  • grpc service will be discovered and its status will be set to SERVING by default
  • Now once everything is up and looking good hit the rest endpoint to shutdown grpcServer
  • Now tomcat server is up and grpcServer is down
  • Send a request to /actuator/health/grpc end point and it will continue to report the service as SERVING

Analysis

  • Lognet's DefaultHealthStatusService seems to be having a bug
  • It extends ManagedHealthStatusService whose onShutdown() method's documentation clearly indicates that "Implementation is advised to set status of all services as ServingStatus.NOT_SERVING"
  • But DefaultHealthStatusService's onShutdown() implementation simply delegates the call to healthStatusManager.enterTerminalState(); without changing the statuses of services to NOT_SERVING in its locally maintained map

References

Fix

Any local state maintained by DefaultHealthStatusService should be cleared out and marked as NOT_SERVING upon onShutdown() method call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions