Backport IP fallback in Gitlab::HTTP to 19.2

Backport of !239733 (merged) into 19-2-stable-ee. Dedicated incident on #560575.

Gitlab::HTTP resolves a host to all its IPs but only connects to the first, since the address is pinned for DNS-rebinding protection. If that one is unreachable, usually a black-holed IPv6 on dual stack, the connect hangs to Net::OpenTimeout and nothing else is tried. Dependency Proxy turns that into a 599 and the job fails to pull. Retrying re-uses the same dead IP.

Straight cherry-pick of 297460597d, no changes. connect now tries the other validated addresses. Capped to one per family, only unreachable errors fall back, no re-resolution.

Fixes the pinned-address case only. An upstream that's unreachable at every address still 599s.

Confined to gems/gitlab-http. No app code, no migrations. Single-address connections unchanged.

cd gems/gitlab-http && bundle exec rspec spec/gitlab/http_v2/ip_fallback_spec.rb

Reviewed on master by @radbatnag and @rcoleman-gitlab.

Edited by Tri Lam

Merge request reports

Loading
Loading