This repository was archived by the owner on Sep 30, 2024. It is now read-only.
backport: github: fix erratic 404s by keeping URL stable (#56478)#56495
Merged
Conversation
See [this comment](sourcegraph/customer#2329 (comment)) and the issue it's in for full context. Short version: 1. GitHub v3 and v4 clients execute this bit of code multiple times when retrying a request after it ran into rate limits: https://github.com/sourcegraph/sourcegraph/blob/16458d7e5c07ac69d00d32841a1a7dcd55a50ddb/internal/extsvc/github/common.go#L1589-L1590 2. When executed multiple times with the same `url.URL`, `req.URL.Path` ends up with invalid paths like `/api/v3/api/v3` That lead to 404 errors showing up _sometimes_: when the client runs into rate limit and retries. And _sometimes_ these 404s were even ignored and lead to a "successful" end of the syncing process. This changes the behaviour of the clients to keep a copy of the original `req.URL` around so that modifications made by `doRequest` don't have unintended side-effects. (cherry picked from commit 8e21962)
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 6cb2ebe...5eeef62.
|
Contributor
BolajiOlajide
approved these changes
Sep 11, 2023
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
**NOTE: This is a backport of https://github.com/sourcegraph/sourcegraph/pull/56478. cc @sourcegraph/release-guild **
See this comment and the issue it's in for full context.
Short version:
url.URL,req.URL.Pathends up with invalid paths like/api/v3/api/v3That lead to 404 errors showing up sometimes: when the client runs into rate limit and retries. And sometimes these 404s were even ignored and lead to a "successful" end of the syncing process.
This changes the behaviour of the clients to keep a copy of the original
req.URLaround so that modifications made bydoRequestdon't have unintended side-effects.(cherry picked from commit 8e21962)
Test plan