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

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

Open
chetan5375 opened this issue Oct 13, 2023 · 1 comment

Comments

@chetan5375
Copy link

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.

@chetan5375
Copy link
Author

@jvmlet did you got a chance to look at this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant