Skip to content

Spring gRPC health check triggers MailHealthIndicator eagerly #50791

Description

@space88man

Problem statement: Spring Boot 4.1.0 / spring-grpc 1.1.0 — combining spring-grpc with Spring Mail causes the SMTP server to be probed every 5 seconds unexpectedly.

The gRPC health scheduler unconditionally invokes all HealthIndicator/HealthContributor beans registered in the global HealthContributorRegistry. The per-service include/exclude filters only control whether a given indicator's result accrues to the health status of a named service — they do not gate whether the indicator is invoked at all. This is silently activated by the presence of any BindableService bean (e.g. gRPC reflection) with no indication that external infrastructure probing will begin.

Desired behaviour: a server-wide filter to prevent specific indicators from being invoked by the gRPC health scheduler entirely, independently of actuator configuration.

Current workaround: include-overall-health: false, which is an all-or-nothing opt-out.
Putting exclude: mail per service does not stop MailHealthIndicator from running.


How should this be configured? Are we supposed to disable overall health?

Enhancement: is it possible to have a server wide filter (don't run mail at all) ?

Update: just realised that includeOverallHealth: false doesn't suppress the indicators.
This member is not actually used by anything:-

> grep -irnH includeOverallHealth
grpc/server/autoconfigure/health/GrpcServerHealthProperties.java:54:    private boolean includeOverallHealth = true;
grpc/server/autoconfigure/health/GrpcServerHealthProperties.java:81:    public boolean isIncludeOverallHealth() {
grpc/server/autoconfigure/health/GrpcServerHealthProperties.java:82:            return this.includeOverallHealth;
grpc/server/autoconfigure/health/GrpcServerHealthProperties.java:85:    public void setIncludeOverallHealth(boolean includeOverallHealth) {
grpc/server/autoconfigure/health/GrpcServerHealthProperties.java:86:            this.includeOverallHealth = includeOverallHealth;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions