Skip to content

Fix load balancer shutdown responsiveness#884

Open
puneetdixit200 wants to merge 1 commit into
cloudflare:mainfrom
puneetdixit200:fix/878-load-balancer-shutdown
Open

Fix load balancer shutdown responsiveness#884
puneetdixit200 wants to merge 1 commit into
cloudflare:mainfrom
puneetdixit200:fix/878-load-balancer-shutdown

Conversation

@puneetdixit200
Copy link
Copy Markdown

Fixes #878

LoadBalancer::run now races shutdown notifications against service discovery updates, health checks, and interval sleeps. That lets the background task return promptly when shutdown arrives instead of waiting for the next loop iteration or a pending update/probe.

For parallel health checks, spawned probe tasks now get abort handles tied to the waiting future, so cancellation does not leave detached pending probe tasks behind.

Tests:

  • cargo test -p pingora-load-balancing background::tests -- --nocapture
  • cargo fmt --all -- --check
  • cargo clippy -p pingora-load-balancing --all-targets -- -D warnings
  • cargo check -p pingora-load-balancing

Local note: cargo test -p pingora-load-balancing --no-fail-fast currently fails in health_check::test_http_custom_check because http://one.one.one.one/ returns 302 in this environment while the existing test expects 301; the new shutdown tests pass.

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.

LoadBalancer::run(): shutdown signal is ignored while sleeping or awaiting update() / run_health_check()

1 participant