Skip to content

Container unhealthy / /actuator/health 503: Spring Boot 4.0 Mongo health indicator probes all Atlas databases #78

Description

@rssrn

Problem

Since the v0.25.2 deploy, the newschart container reports unhealthy and /actuator/health returns 503 on live — while the app itself serves fine (all /api/news/* endpoints return 200; data queries against Atlas work normally).

Two things intersected:

  1. v0.25.2 added a Docker healthcheck polling /actuator/health — this made a pre-existing 503 visible for the first time.
  2. Spring Boot 4.0 rewrote MongoHealthIndicator (spring-boot#47051): instead of one hello command against the configured database (Boot 3.x behaviour), it now iterates listDatabaseNames() and runs {hello: 1} against every database. On Atlas, that list includes system DBs (local, admin) that the app user can list but not run commands on:
com.mongodb.MongoCommandException: Command execution failed on MongoDB server with error 8000
(AtlasError): '(Unauthorized) not authorized on local to execute command { hello: 1, ... }'

The whole health check throws → DOWN → 503 → Docker marks the container unhealthy.

This is a confirmed upstream regression: spring-boot#50727 (same failure mode, plus a connection-count explosion for fleets). Fixed upstream in PR #50734, milestone 4.0.8 — the indicator will run hello once against admin, which any authenticated Atlas user is allowed to do. Not yet released (latest is 4.0.7; even 4.1.0 GA still has the broken loop).

Workaround in place

management.health.mongodb.enabled=false in application.properties — disables the Mongo health indicator so /actuator/health returns 200 and the container healthcheck passes. Trade-off: no Mongo connectivity signal in health output until the upstream fix arrives.

On hold until Spring Boot 4.0.8 is released

  • Wait for Spring Boot 4.0.8 (expected ~mid/late July 2026; Dependabot should pick it up)
  • Upgrade to 4.0.8
  • Revert the workaround: remove management.health.mongodb.enabled=false from application.properties, restoring the (now Atlas-safe) built-in Mongo health check
  • Verify on live: /actuator/health returns 200 with a Mongo component reported UP, and the container shows healthy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions