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

Add retry-on-failed download #57

Closed
nickheyer opened this issue Jul 24, 2024 · 2 comments
Closed

Add retry-on-failed download #57

nickheyer opened this issue Jul 24, 2024 · 2 comments

Comments

@nickheyer
Copy link

Just got an error while attempting to curling https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz...
Transfer closed with xxxxxxx bytes remaining to read. Ie: Connection timed out for whatever reason.

In a prod env, when we are unable to control unknown variables like a stable network for the servers hosting node's repos, or even our own network on occasion, the solution is to almost always retry (with a back-off delay). You should add such a delay to the default behavior, or better yet add alternate mirrors to use on failed downloads, etc.

16:23:03 #7 2.290 1 of 2: 10.15.0...
16:23:03 #7 2.314 installing : node-v10.15.0
16:23:03 #7 2.412 mkdir : /home/tester/n/n/versions/node/10.15.0
16:23:03 #7 2.416 fetch : https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz
16:23:04 #7 3.350 curl: (18) transfer closed with 3224425 bytes remaining to read
16:23:04 #7 3.366 xz: (stdin): Unexpected end of input
16:23:04 #7 3.369 tar: Unexpected EOF in archive
16:23:04 #7 3.369 tar: Unexpected EOF in archive
16:23:04 #7 3.369 tar: Error is not recoverable: exiting now
16:23:04 #7 3.370
16:23:04 #7 3.370 Error: failed to download archive for 10.15.0
16:23:04 #7 3.370
16:23:04 #7 3.371 n-install: WARNING: Failed to install version '10.15.0'.
16:23:04 #7 3.371 2 of 2: 6.11.2...
16:23:04 #7 3.387 installing : node-v6.11.2
16:23:04 #7 3.451 mkdir : /home/tester/n/n/versions/node/6.11.2
16:23:04 #7 3.455 fetch : https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz
16:23:05 #7 4.519 copying : node/6.11.2
16:23:06 #7 5.240 installed : v6.11.2 (with npm 3.10.10)
16:23:06 #7 5.251 === n successfully installed.
16:23:06 #7 5.251 The active Node.js version is: v6.11.2
16:23:06 #7 5.251
16:23:06 #7 5.251 Run n -h for help.
16:23:06 #7 5.251 To update n later, run n-update.
16:23:06 #7 5.251 To uninstall, run n-uninstall.
16:23:06 #7 5.251
16:23:06 #7 5.251 IMPORTANT: OPEN A NEW TERMINAL TAB/WINDOW or run . /home/tester/.bashrc
16:23:06 #7 5.251 before using n and Node.js.
16:23:06 #7 5.251 ===
16:23:06 #7 DONE 5.9s

@shadowspawn
Copy link

Related upstream issue: tj/n#784

For interest, NodeJS are in the process of improving their web infrastructure so that updates to their web site and downloads do not cause a brief outage while the cache is refreshed.

@mklement0
Copy link
Owner

Thanks for the additional info, @shadowspawn.

@nickheyer, I think @shadowspawn's comment on the linked issue applies analogously to this project in this case:

I currently don't think a retry is appropriate in the n code. There are lots of things that can go wrong, including systematic problems that need fixing before an attempt can work. I prefer failing fast and leaving it up to the caller to decide how to proceed.

@mklement0 mklement0 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2024
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

No branches or pull requests

3 participants