Skip to content

Add max retries to Prevent infinite loop in DB load balancer

Related to #344888 (closed).

  1. Have a loop breaker to prevent infinite loops

When doing a DB read, we rescue connection errors and retry in while

https://gitlab.com/gitlab-org/gitlab/-/blob/a0bb94ba04aa20557b1102173d7e391f4701765f/lib/gitlab/database/load_balancing/load_balancer.rb#L50

In #344888 (closed) we had an infinite loop problem. I think we should add a max retries here say maybe a 100 max attempts ? I don't think any GitLab instance will ever have 100 hosts, or more.

  1. Log when the primary host calls offline! to help detect infinite loops !73904 (merged)
Edited by Thong Kuah