Repository navigation
fix(mirror): recover from a cut-off GitHub release listing - #306
Merged
Merged
Conversation
fetchWithRetry replaces httpGetWithRetry and reads the whole body inside
the retry, so a response GitHub drops part way through ("stream error:
... CANCEL") is fetched again instead of failing the source.
Generate Manifests from R2 now also runs after a failed Mirror Sync, so
one failed source or download no longer keeps everything else that
synced out of the manifests.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Today's Mirror Sync failed its Python job:
GitHub dropped page 7 of the python-build-standalone release listing part way through. A page of 10 releases is tens of megabytes of JSON.
httpGetWithRetryonly retried failed connections and 5xx responses, so a body that broke off while being decoded failed the whole source, and with it the Python job.The failed job then held back everything else. Generate Manifests from R2 ran only when Mirror Sync succeeded, so today's run was skipped: Node.js and Ruby synced fine, but nothing they mirrored reached the manifests.
Type of Change
Related Issues
Relates to #305
Changes Made
fetchWithRetryreplaceshttpGetWithRetry. It reads the whole body inside the retry, so a response cut off part way is fetched again like a failed connection or a 5xx response. Other statuses come back for the caller to check, as before. The python-build-standalone and RubyInstaller listings, the ruby-builder release and python.org downloads use it.Testing
Test Environment
Test Steps
TestFetchWithRetry: a body cut off and then complete, a 5xx and then complete, a 4xx returned without a retry, and a cut-off body or 5xx on every attempt (error after 3 attempts). The cut-off is a hijacked connection that promises 1000 bytes, sends a few and closes.TestFetchGitHubReleases_CutOffPage: page 2 is cut off once; all 25 releases come back, with page 2 fetched twice.go run . --runtime python --dry-runagainst live upstream lists the same 759 jobs as before: 578 from python-build-standalone and 181 from python.org.Test Results
./rnr checkfails only onTestGlobalVersion_NoConfigFileandTestGlobalVersion_RuntimeNotInConfigininternal/config, the same failures as on unmodifiedmainon the machine I tested on. Nothing undersrc/changed.golangci-linton the mirror tool reports 15 issues, all in code this PR doesn't touch, against 19 onmain. The 4 it no longer reports were uncheckedresp.Body.Closecalls replaced byfetchWithRetry.Checklist
golangci-lint runand fixed all issues (includes gofmt, govet, and 40+ linters) (no new findings; older ones in the mirror tool left as they are)go mod tidyto clean up dependenciesgo test ./...) (apart from the twointernal/configtests above, unchanged frommain)Breaking Changes
N/A
Additional Notes