Skip to content

Fail fast for closed pool health checks#2403

Open
ittaigolde wants to merge 1 commit into
brettwooldridge:devfrom
ittaigolde:fix-healthcheck-closed-pool
Open

Fail fast for closed pool health checks#2403
ittaigolde wants to merge 1 commit into
brettwooldridge:devfrom
ittaigolde:fix-healthcheck-closed-pool

Conversation

@ittaigolde

Copy link
Copy Markdown
Contributor

Fixes #2325.

The Dropwizard connectivity health check keeps a direct HikariPool reference. After HikariDataSource.close(), calling the health check still went through pool.getConnection(checkTimeoutMs), so it waited for the configured health-check timeout even though the pool was already shut down and could never provide a connection.

This change makes ConnectivityHealthCheck return an unhealthy result immediately when the pool is already shut down.

Reproduction before the fix:

  • CodahaleMetricsTest#testConnectivityHealthCheckFailsFastAfterShutdown waited 765ms with connectivityCheckTimeoutMs=750.

Verification after the fix:

  • JDK 21.0.11: mvn -Djacoco.skip=true -Dtest=CodahaleMetricsTest test
  • JDK 25.0.3: mvn -Djacoco.skip=true -Dtest=CodahaleMetricsTest test

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

Successfully merging this pull request may close these issues.

Dropwizard HealthCheck waits for connection timeout on shutdown pool

1 participant