Race condition in BatchObjectDownloadStage (original) (raw)
I hit a situation when prefetching with "--files *" when almost all the blobs were already present. The logs showed that 3 blobs were missing, but that no download requests were made. The missing blobs were not actually downloaded (which wouldn't be a problem working with git through commandline or file system, but I was trying to use Libgit2 to build a tree using the blobs and it failed because they were missing). Running "gvfs prefetch --files *" again claimed that all blobs were prefetched so there was nothing to download, but they were still missing. Running "gvfs prefetch --files" and providing the actual files needed caused them to be prefetched.
I suspect that there is a race condition in BatchObjectDownloadStage between
L222 and L227. It seems possible for the missingBlobs collection to finish adding in between those two lines, in which case any blobs that were added during that time would not be downloaded.