-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After a failed file download, all subsequent downloads fail for same session #2194
Comments
I enabled debug logging for the client with
|
With some more logging, we're getting a HTTP 416 error, which means invalid range header. For some reason the
But: # Update the range request if we're retrying
if retry > 0:
data["headers"]["Range"] = f"bytes={bytes_written}-"
logger.debug(f"Retry {retry}, range: {bytes_written}-") Feels like there's some cross-request data collision here... |
OK, got it. In download_submission() we have: response = self._send_json_request(
method,
path_query,
stream=True,
headers=self.req_headers,
timeout=timeout or self.default_download_timeout,
) Importantly If we instead do |
Practically this means anything that triggered a retry would work, but break any future download. I'm not sure if this is the sole bug here that's causing problems, there's at least one other logic issue. |
A regression test for this would need to 1) trigger a download request that fails, but only after downloading some a non-zero amount of bytes; and then 2) triggers other downloads that succeed. I don't think we have a good way to simulate 1 yet, so I'm punting on it in favor of manual testing for the hotfix. |
When we introduced retries with `Range` support, it was the first time we started mutating the request headers. At the time we didn't realize that headers are stored in a single dict that is used across requests, so the `Range` header would get reused in other requests, and then of course fail. This affected any session in which a Range request was needed, so if no download ever failed, you'd never hit it. To fix it, we now generate a fresh dictionary on each request. This will add a small amount of performance overhead, but it's not going to be noticeable and more importantly, makes it impossible to re-use the header dictionary across requests. Add some more debug entries for future operations as well. Fixes #2194. (cherry picked from commit ba01651)
Description
From a user report:
Related: #1633 (general issue)
Steps to Reproduce
See previous
Expected Behavior
Actual Behavior
See above
Comments
The text was updated successfully, but these errors were encountered: