Add BBS-connectivity health check to auctioneer - #1186
Open
ivo1116 wants to merge 1 commit into
Open
Conversation
Adds an optional ifrit runner that periodically probes BBS via `bbs.Client.Ping()`. On N consecutive failures the auctioneer exits, letting monit restart it so its Locket lock is released cleanly and a healthy-AZ standby can acquire leadership. Motivation ---------- Under a DNS-only partition affecting `bbs.service.cf.internal`, the auctioneer's Locket lock renewal path (persistent gRPC connection, Locket-side pooled DB connections) keeps succeeding while its functional path (fresh DNS per auction request to BBS) fails on every call. The two paths share no state, so a functionally-dead leader retains the lock indefinitely. Fix --- Auctioneer analog of the BBS `enable_db_health_check` pattern: a runner in the ifrit group that exits the process on consecutive Ping failures so the normal SIGTERM path releases the Locket lock. Configuration (all disabled by default to preserve current behavior) - diego.auctioneer.enable_bbs_health_check (default: false) - diego.auctioneer.bbs_health_check_interval (default: 10s) - diego.auctioneer.bbs_health_check_timeout (default: 5s) - diego.auctioneer.bbs_health_check_failure_threshold (default: 3) Worst-case detection latency is interval * threshold. Testing ------- Two Go unit tests cover the threshold-exit and recovery paths using a fake bbs.Client and a fakeclock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
enable_bbs_health_checkrunner to the auctioneer. When enabled, the auctioneer periodically probes BBS viabbs.Client.Ping()and exits after N consecutive failures. Monit then restarts it, and the normal SIGTERM path releases the auctioneer's Locket lock cleanly so a healthy-AZ standby can acquire leadership.Disabled by default — no behavior change unless the property is set.
Motivation
The auctioneer's Locket lock is renewed over a persistent gRPC connection to Locket, whose DB path is served from a warm connection pool — DNS-free.
Auction work, in contrast, resolves
bbs.service.cf.internalon every call — DNS-dependent.Under a DNS-only partition, renewals keep succeeding while the leader can't do any actual work. The two paths share no state, so the process does not self-evict and the Locket lock's 15-second TTL is continuously bumped forward. A functionally-dead leader retains the lock indefinitely, blocking failover.
This PR is the auctioneer analog of the BBS
enable_db_health_checkpattern.Configuration
diego.auctioneer.enable_bbs_health_checkfalsediego.auctioneer.bbs_health_check_interval10sdiego.auctioneer.bbs_health_check_timeout5sdiego.auctioneer.bbs_health_check_failure_threshold3Worst-case detection latency =
interval × threshold.Implementation
src/code.cloudfoundry.org/auctioneer/cmd/auctioneer/bbs_health_check_runner.go— the ifrit runner.cmd/auctioneer/config/config.go.Membersgroup incmd/auctioneer/main.gobehindcfg.EnableBBSHealthCheck.jobs/auctioneer/specand template wiring injobs/auctioneer/templates/auctioneer.json.erb.Uses the existing
bbs.Client.Ping(logger, traceID)method — same DNS/TLS/HTTP path the auction code uses, so functional degradation manifests identically to the health check.The probe is wrapped in a
context.WithTimeoutso a hung Ping cannot stall the health-check goroutine. Recovery is logged asbbs-health-check.recoveredwhen a probe succeeds after prior failures, resetting the counter.Tests
Two Go unit tests in
bbs_health_check_runner_test.gousing a fakebbs.Clientandfakeclock:TestBBSHealthCheckRunner_ExitsOnThreshold— the runner returns a non-nil error afterfailureThresholdconsecutive failed probes.TestBBSHealthCheckRunner_RecoversOnSuccess— a successful probe resets the counter and the runner continues.