volta
volta copied to clipboard
[Investigation] More Granular errors for downloading Node / Yarn
From discussion on Discord related to failures we're seeing when downloading / unpacking Node:
[@rwjblue] basically, as far as I can see it, we have a few different possible failure scenarios:
- HTTP server doesn't have a 200
- downloading fails before the full file has been retrieved
- unpacking fails (because while the file has been fully retrieved, it is still invalid)
Currently, since we are streaming the unpack (unpacking as the data comes in from the HTTP response), the latter two error cases are combined into a single failure (since if the download fails, the unpacking will ultimately fail as well). This makes it difficult for users to understand what actually happened, and also makes it difficult on the maintainers to help debug the underlying failure.
We should investigate:
- Downloading the entire archive and then unpacking, to confirm if there is a significant drop in performance or not.
- Using the
Content-Lengthheader to determine if the download is complete when streaming, to figure out if an unpack error was actually an invalid format or if the download halted unexpectedly. - (Long term) Fetching the SHASUM for the download archive as well, so that we can verify the contents are correct before unpacking. This may require new hook for the shasum download.