This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 886
rkt/image: lock temp files to avoid problems with concurrent fetches #2239
Merged
Conversation
This file contains 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
When figuring out if we can resume a session, if we get a bad HTTP status, we were just returning without error and weren't resetting the session. This means we will download the full file *on top* of the already present file, which of course leads to a corrupted file. Reset the session in that case.
Whenever we create a Store temporary file, we lock it so concurrent downloads don't corrupt it.
Ping? |
How come the functional tests didn't catch the bug that got fixed by the first commit? |
IIRC, S3 is returning some 4xx error when trying to resume a download, which our test server doesn't. |
_, err = lock.TryExclusiveLock(tmp.Name(), lock.RegFile) | ||
if err != nil { | ||
if err != lock.ErrLocked { | ||
return nil, err |
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.
Maybe add some text describing what failed? "failed to lock a file" or something?
This should prevent corrupting the image, but rkt will download the same image again. Not sure if we should worry about it in this PR. Anyway, one nit about error message, otherwise LFAD. |
Updated |
iaguis
force-pushed
the
iaguis/concurrent-fetch
branch
from
March 15, 2016 08:49
9d05ffc
to
0a3f785
Compare
krnowak
added a commit
that referenced
this pull request
Mar 15, 2016
rkt/image: lock temp files to avoid problems with concurrent fetches
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Whenever we create a Store temporary file, we lock it so concurrent
downloads don't corrupt it.
Fixes #2165