Repository navigation
Prebuilt installers: retry a download the server drops - #11816
Merged
Merged
Conversation
urllib wraps only a failure to send the request in URLError. A server that closes the connection before answering raises http.client.RemoteDisconnected out of getresponse(), and a reset or short body mid-download raises ConnectionResetError or IncompleteRead; is_retryable_url_error treated all of them as fatal, so one dropped connection skipped every remaining attempt. On #11808's no-Visual-Studio Windows leg that sent a clean install to the source build on the first attempt: candidate attempt failed before activation for app-b11139-mix-a6922cc-windows-x64-cpu.zip: Remote end closed connection without response ConnectionError and IncompleteRead are now retryable in prebuilt_core (llama.cpp and whisper.cpp) and in install_node_prebuilt, which had the same gap. Both download loops already restart from a fresh temp file or buffer, so a retry cannot splice two bodies together.
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
shaojun
pushed a commit
to shaojun/unsloth
that referenced
this pull request
Sep 29, 2026
urllib wraps only a failure to send the request in URLError. A server that closes the connection before answering raises http.client.RemoteDisconnected out of getresponse(), and a reset or short body mid-download raises ConnectionResetError or IncompleteRead; is_retryable_url_error treated all of them as fatal, so one dropped connection skipped every remaining attempt. On unslothai#11808's no-Visual-Studio Windows leg that sent a clean install to the source build on the first attempt: candidate attempt failed before activation for app-b11139-mix-a6922cc-windows-x64-cpu.zip: Remote end closed connection without response ConnectionError and IncompleteRead are now retryable in prebuilt_core (llama.cpp and whisper.cpp) and in install_node_prebuilt, which had the same gap. Both download loops already restart from a fresh temp file or buffer, so a retry cannot splice two bodies together.
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.
Summary
A single dropped connection while downloading a prebuilt bundle skipped every retry. On #11808's
Unsloth install + inference without Visual Studioleg (Windows, no build tools) the CPU bundle download was cut off once and the installer went straight to a source build, which that machine cannot do:HTTP_FETCH_ATTEMPTSis 4, but only errorsis_retryable_url_erroraccepts are retried. urllib wraps just a failure to send the request inURLError;do_opencallsh.getresponse()outside that wrapper, so a server that closes the connection before answering raiseshttp.client.RemoteDisconnected(aConnectionResetError) raw. A reset or short body during the read raisesConnectionResetErrororhttp.client.IncompleteRead. None of these were retryable, so each one was fatal on the first attempt. The gap dates back to the classifier's introduction; this run is simply the first to hit it here.Change
studio/prebuilt_core.py(llama.cpp and whisper.cpp):ConnectionErrorandhttp.client.IncompleteReadare retryable.studio/install_node_prebuilt.pyhas its own copy of the classifier with the same gap; same change.Both download loops already start each attempt from a fresh temp file or buffer, so a retry cannot splice two partial bodies together. Programming errors (
ValueError,FileNotFoundError) are still not retried.Test
New cases in
tests/studio/install/test_prebuilt_core.py:test_a_dropped_connection_is_retried:RemoteDisconnected,ConnectionResetError,ConnectionAbortedErrorandIncompleteRead, for both classifiers.test_a_download_that_drops_once_is_retried_to_completion: a fake opener that drops once, before the response and mid-body, then serves the file; the download completes on the second request with the full body and no stray temp file.test_a_programming_error_is_still_not_retried.Against main's
prebuilt_core.pyandinstall_node_prebuilt.pythe 10 dropped-connection cases fail; with this change all 12 pass.tests/studio/install,tests/test_setup_master_root.pyandtests/test_installer_interactive_prompts.py: 9266 passed.