Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions GVFS/GVFS.Common/GVFSLock.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ public static bool TryAcquireGVFSLockForProcess(
}
};

bool isSuccessfulLockResult;
if (unattended)
{
waitForLock();
isSuccessfulLockResult = waitForLock();
}
else
{
ConsoleHelper.ShowStatusWhileRunning(
isSuccessfulLockResult = ConsoleHelper.ShowStatusWhileRunning(
waitForLock,
message,
output: Console.Out,
Expand All @@ -96,7 +97,7 @@ public static bool TryAcquireGVFSLockForProcess(
}

result = null;
return true;
return isSuccessfulLockResult;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the investigations. Yea this is a pretty glaring hole. We should definitely follow up to find out why we didn't have a reliably failing test as a result of this bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading through this, and it's not as bad as it seems - which also explains the lack of test failures. In the normal case, this method blocks until the lock is acquired, so the return value is always true. However, that assumption fails once an unmount is initiated, in which case we have to pass through the false result. Constructing a reliable test for that will be tricky, since it's so timing dependent. Your fix does make sense, and assuming that the git status cache stops misbehaving during unmount, that is a pretty good validation of this fix too.

}

public static void ReleaseGVFSLock(
Expand Down
5 changes: 4 additions & 1 deletion GVFS/GVFS.Virtualization/FileSystemCallbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,11 @@ public void Stop()
this.postFetchJobThread?.Abort();
}

this.fileSystemVirtualizer.PrepareToStop();
// Shutdown the GitStatusCache before other
// components that it depends on.
this.gitStatusCache.Shutdown();

this.fileSystemVirtualizer.PrepareToStop();
this.backgroundFileSystemTaskRunner.Shutdown();
this.GitIndexProjection.Shutdown();
this.BlobSizes.Shutdown();
Expand Down