Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: recover BalancedPool after equal-weight outage state#4842

Open
mcollina wants to merge 1 commit intomainfrom
fix/balanced-pool-recovery-4839
Open

fix: recover BalancedPool after equal-weight outage state#4842
mcollina wants to merge 1 commit intomainfrom
fix/balanced-pool-recovery-4839

Conversation

@mcollina
Copy link
Member

Summary

  • fix BalancedPool weighted round-robin recovery after outages when all upstream weights reach the minimum value
  • avoid mutating scheduler state during dispatcher availability probes by adding a non-mutating peek mode to kGetDispatcher callers
  • add a regression test that reproduces the 2-upstream outage/recovery scenario from BalancedPool deteriorates to a single point of failure after outages #4839

Details

When two upstreams both degrade to weight 1, BalancedPool could repeatedly select the same failed upstream and never probe the healthy one during recovery.

This was caused by two interactions:

  1. stateful dispatcher selection was being invoked for a "can dispatch?" probe in PoolBase, advancing scheduler state unexpectedly
  2. weighted round-robin weight reset used maxWeightPerServer instead of the current max available upstream weight

Testing

  • npx borp -p "test/node-test/balanced-pool.js"
  • npx borp -p "test/pool.js" -p "test/round-robin-pool.js"
  • npm run lint

Closes: #4839

Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests doesn't seems happy

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.

BalancedPool deteriorates to a single point of failure after outages

2 participants