Skip to content
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

Retry downloads if connection terminated mid-response #2949

Closed
dmichon-msft opened this issue Oct 22, 2020 · 2 comments · Fixed by #2971
Closed

Retry downloads if connection terminated mid-response #2949

dmichon-msft opened this issue Oct 22, 2020 · 2 comments · Fixed by #2971
Assignees
Milestone

Comments

@dmichon-msft
Copy link
Contributor

pnpm version: 5.9.0

Code to reproduce the issue:

Happens under load on an Azure DevOps Pipeline Agent. Force terminating a connection mid-download in any fashion should repro.

Sometimes connections will get dropped during a download, but after the success headers have been sent. Would be helpful if the fetch wrapper could assume that a JSON parse failure in a registry info fetch or a tarball size mismatch was due to such an issue and retry, rather than terminating the entire process.

Expected behavior:

 WARN  GET https://<REDACTED>/npm/registry/image-size error (Unexpected end of JSON input). Will retry in 10 seconds. 2 retries left.

Actual behavior:

 ERROR  invalid json response body at https://<REDACTED>/npm/registry/image-size reason: Unexpected end of JSON input
at                ../../../../.rush/node-v10.22.1/pnpm-5.9.0/node_modules/pnpm/lib/node_modules/node-fetch-unix/lib/index.js:253  return Body.Promise.reje…
at _tickCallback  internal/process/next_tick.js:68                                                                                                         

The command failed:
 /Users/runner/work/1/common/temp/pnpm-local/node_modules/.bin/pnpm install --store /Users/runner/work/1/common/temp/pnpm-store --no-prefer-frozen-lockfile --recursive --link-workspace-packages false
ERROR: Error: The command failed with exit code 1

Additional information:

  • node -v prints: 10.22.1
  • Windows, OS X, or Linux?: OS X
@zkochan
Copy link
Member

zkochan commented Nov 7, 2020

a tarball size mismatch was due to such an issue

this one should already be retried because we check the size of the tarball and also the actual checksum

regarding the JSON, I'll have to look into it. I thought I already worked on this.

Do you commit pnpm-lock.yaml to the repository? If you would, pnpm would not fetch the metadata jsons at all

@zkochan
Copy link
Member

zkochan commented Nov 8, 2020

🚢 5.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants