git-lfs/tq
Marat Radchenko 0c8edfc097 Stop replacing files in LFS storage when downloading them concurrently on Windows
On Windows, there is no way to replace file atomically. Instead, MoveFileExA:

1. Calls CreateFileA(access=Delete, shareMode=Delete)
2. Calls SetRenameInformationFile to rename file
3. Calls CloseFile

The problem is that if parallel process attempts to open destination file for reading between
steps 2 and 3, it will try to do that without shareMode=Delete and will hit a SHARING_VIOLATION error.

In practice, this race condition results in:

  Smudge error: Error opening media file.: open .git\lfs\objects\<sha>: The process cannot access the file because it is being used by another process.

There are two solutions here:

 1. Do not overwrite file if it already exists
 2. Retry reading from file if got a SHARING_VIOLATION

This commit implements option 1.

Fixes #2825 (for Windows, other OSes are race-free already). Also see #3813 and #3826.
2019-10-25 10:54:25 +03:00
..
schemas tq,lfsapi/ssh: convert int64 to int 2017-04-05 14:46:45 -06:00
adapterbase.go Fix error strings to follow Go guidelines 2019-10-22 17:33:49 +03:00
api_test.go lfsapi: extract new lfshttp package 2018-09-11 14:51:29 -07:00
api.go Don't fail if we lack objects the server has 2019-07-15 20:47:04 +00:00
basic_download.go Stop replacing files in LFS storage when downloading them concurrently on Windows 2019-10-25 10:54:25 +03:00
basic_upload.go tq: avoid nil pointer dereference on unexpected failure 2019-02-20 14:47:35 +00:00
custom_test.go lfsapi: extract new lfshttp package 2018-09-11 14:51:29 -07:00
custom.go Fix error strings to follow Go guidelines 2019-10-22 17:33:49 +03:00
errors_test.go tq/errors: implement MalformedObjectError 2017-03-24 14:36:59 -06:00
errors.go tq/errors: implement MalformedObjectError 2017-03-24 14:36:59 -06:00
manifest_test.go lfsapi: extract new lfshttp package 2018-09-11 14:51:29 -07:00
manifest.go Provide support for file URLs via a transfer agent 2019-08-02 17:23:47 +00:00
meter.go Use proper repo permissions when creating directories 2018-12-13 17:51:02 +00:00
transfer_queue_test.go tq: add fs.Filesystem to tq.Manifest 2017-10-25 12:25:06 -06:00
transfer_queue.go Avoid deadlock when transfer queue fails 2019-09-09 17:06:59 +00:00
transfer_test.go lfsapi: extract new lfshttp package 2018-09-11 14:51:29 -07:00
transfer.go Don't fail if we lack objects the server has 2019-07-15 20:47:04 +00:00
tus_upload.go Fix error strings to follow Go guidelines 2019-10-22 17:33:49 +03:00
verify_test.go tq: use correct access 2018-09-28 14:16:55 -07:00
verify.go tq: ensure we pass the correct Accept header in verify requests 2019-05-22 21:01:54 +00:00