-
Notifications
You must be signed in to change notification settings - Fork 195
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
FileDistributedLock is not thread safe #109
Comments
Thanks for reporting @Invenisso . I have a related but distinct issue filed here: #106. One thing I'm struggling with is that (afaik) there are times when we can hit I want to avoid a case where we legitimately don't have permission to the lock file but we behave as though we just couldn't acquire it. One thought I have is that Do you have a snippet of code that easily reproduces this for you? What version of .NET are you running on? |
Ok I have a test which repros this reliably:
|
@Invenisso I've published a prerelease version of DistributedLock.FileSystem containing what I believe to be a fix. Would you mind trying it out in your environment and letting me know if it resolves the issues you were seeing? Thanks! https://www.nuget.org/packages/DistributedLock.FileSystem/1.0.1-rc01 |
@madelson Thank you for taking care of the problem! I will check your fix as soon as I get back to work on monday, because now I don't have access to my environment. |
I can confirm that the error is no longer present when I use the new package. Thanks for fixing. :-) |
Released in DistributedLock.FileSystem 1.0.1 / DistributedLock 2.3.0 |
In heavy multithreading scenario (>10 parallel threads) 84. line throws System.UnauthorizedAccessException which is not properly caught.
Stack trace:
The exception is later caught, but only if a directory with the same name as the file already exists. You also need to catch this exception without any condition and return null as the result.
(Tested on Windows 10.)
The text was updated successfully, but these errors were encountered: