n: Retry when downloading/extraction of Node.js tar fails

Is your feature request related to a problem? Please describe.

Sometimes the downloading of Node.js artifact fails because of some network issue.

In our release CI, we noticed it happening twice on Sep 20th

First occurrence

       fetch : https://nodejs.org/dist/v14.21.3/node-v14.21.3-linux-x64.tar.xz
curl: (92) HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)
xz: (stdin): Unexpected end of input
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
   Error: failed to download archive for 14.21.3

The second occurrence on retry was similar, but for node v18.18.0

       fetch : https://nodejs.org/dist/v18.18.0/node-v18.18.0-linux-x64.tar.xz

Describe the solution you’d like

When fetching the tar of Node.js version fails, add a retry with some delay?

Describe alternatives you’ve considered

for i in {1..5}; do n 18 && break || sleep 15; done

Additional context

This issue was discussed in the past in https://github.com/tj/n/issues/287, but closed as network error didn’t appear again for the user

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Ah, a known problem due to CDN cache being purged multiple times per day: