This repository was archived by the owner on Sep 30, 2024. It is now read-only.
github: fix erratic 404s by keeping URL stable#56478
Merged
Merged
Conversation
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff ad1e9a9...8484d15.
|
eseliger
approved these changes
Sep 8, 2023
eseliger
left a comment
Member
There was a problem hiding this comment.
Thanks for tests!
Changelog entry + backport?
keegancsmith
approved these changes
Sep 8, 2023
pjlast
approved these changes
Sep 11, 2023
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.
1f33105 to
8484d15
Compare
Contributor
Author
Done and on the way |
Collaborator
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.1 5.1
# Navigate to the new working tree
cd .worktrees/backport-5.1
# Create a new branch
git switch --create backport-56478-to-5.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8e219623bab03cc15c520f9b2d9012ebd3f759c9
# Push it to GitHub
git push --set-upstream origin backport-56478-to-5.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.1If you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-56478-to-5.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.1
|
mrnugget
added a commit
that referenced
this pull request
Sep 11, 2023
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
Author
|
manually created backport here: https://github.com/sourcegraph/sourcegraph/pull/56495/files |
BolajiOlajide
added a commit
that referenced
this pull request
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.
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.Test plan