Wait for extraction to finish before reporting a download install complete - #1009
Open
X-Guardian wants to merge 1 commit into
Open
X-Guardian wants to merge 1 commit into
X-Guardian wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
place_binaryinlib/install.jsresolves when the HTTP response body ends, not when tar has finished writing the extracted files. The callback can therefore fire while the binary is still being written, and install goes straight on to load it withtestbinary.Extracting a 5 MB file from a local tarball and checking its size at each event shows the gap, identically across three runs:
Effects
Truncated binary. On a slow or scanned filesystem (Windows with antivirus is the likely case)
testbinarycan load a partly written.nodefile and fail, or install can report success while the file is still incomplete.Lost errors. An extraction error raised after the response ends is dropped, because the promise has already resolved and the later
rejectdoes nothing.Change
Resolve on the tar extract stream's
closeinstead of the source'send, keeping the existing rejects on errors from either stream. This matches the other two extract paths in the same file: the authenticated S3 download (place_binary_authenticated) andextract_from_localboth already wait forclose.