Skip to content
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

Threading issues with DirectoryUtility.CreateSharedDirectory cause failures in restore/pack on Linux/Mac #7977

Closed
nkolev92 opened this issue Apr 8, 2019 · 1 comment · Fixed by NuGet/NuGet.Client#2795

Comments

@nkolev92
Copy link
Member

nkolev92 commented Apr 8, 2019

Likely root cause of #7341.

This is the issue tracking the fix. The other issue has lots of engagement and I want to avoid closing it before getting a confirmation that the issues have been fixed.

NuGet/NuGet.Client#2795

During the investigation of #7908, I found that this utility has threading issues. I have a test app that reliably repros the behavior: https://github.com/nkolev92/NuGet.Tools/tree/master/DirectoryUtilityRepro/TestApp

The Directory.CreateDirectory & Directory.Move methods do not guarantee thread safety. They merely guarantee filesystem consistency.

Through my tests I narrowed down the issue to Directory.Move not throwing every time when the dest path exists in the case where multiple threads are trying to create the same directory. Directory.Move never claims thread safety, but rather only filesystem consistency. Effectively on Linux we’d have multiple moves succeed, because the underlying “rename” syscall allows for the destdir to be overridden.

@nkolev92
Copy link
Member Author

nkolev92 commented Apr 8, 2019

Fixed in NuGet/NuGet.Client#2795

@nkolev92 nkolev92 closed this as completed Apr 8, 2019
@nkolev92 nkolev92 changed the title Threading issues with DirectoryUtility.CreateSharedDirectory Threading issues with DirectoryUtility.CreateSharedDirectory cause failures in restore/pack Apr 22, 2019
@nkolev92 nkolev92 changed the title Threading issues with DirectoryUtility.CreateSharedDirectory cause failures in restore/pack Threading issues with DirectoryUtility.CreateSharedDirectory cause failures in restore/pack on Linux/Mac Apr 22, 2019
@nkolev92 nkolev92 added this to the 5.1 milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant