-
Notifications
You must be signed in to change notification settings - Fork 870
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
#794 Node, npm and yarn installer delete corrupted archive #807
Conversation
this.logger.error("The archive file {} is corrupted and will be deleted. " | ||
+ "Please try the build again.", archive.getPath()); | ||
archive.delete(); | ||
if (packageDirectory.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "package" directory is partially filled (dirty), for this reason should be purged
this.logger.error("The archive file {} is corrupted and will be deleted. " | ||
+ "Please try the build again.", archive.getPath()); | ||
archive.delete(); | ||
FileUtils.deleteDirectory(tmpDirectory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to check that tmpDirecory
exists (guaranteed by the flow)
this.logger.error("The archive file {} is corrupted and will be deleted. " | ||
+ "Please try the build again.", archive.getPath()); | ||
archive.delete(); | ||
if (installDirectory.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code cleanups the installDirectory, but there is a probabilty to use corrupted (incomplete) Yarn dist.
The node, npm and yarn installer deletes corrupted archive and destination directory in case if the downloading was interrupted (causes EOFException when extracted).
} | ||
} | ||
|
||
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the possible alternate option here is to re-download one more time
but the probability of this failure is minor, so in case if it happens the user should not even understand what happened :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related issue - #882 - auto-delete triggers but the auto-retry probably would be nice as a future enhancement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, downloader would benefit from downloading to a tmp location and then moving post download, I put a comment here.
Thanks, that looks good! |
Summary
Issue #794
The node, npm and yarn installer deletes corrupted archive and destination directory in case if the downloading was interrupted (causes EOFException when extracted).
Detailed
The possible real-life example:
This requires manual investigation and deleting the cached archive and can take much time.
How to simulate it locally.
$HOME/.m2/repository/com/github/eirslett/node/${node.version}
directory-full
suffix and make it's partial copy of first bytes:Please note, that no integration tests are provided for the reasons of non-clear approach for it (the build should be interrupted while the archive is being downloaded; or it can be pre-cached manually to the maven directory). I tested it locally step-by-step.
Also please note, that there is another way to solve this:
The downloading should be done to a temp file unless completed and then renamed to destination. Both approaches can be mixed in case if someone will face the described above scenario expecting that it will be solved with plugin update.