madelson / DistributedLock

A .NET library for distributed synchronization
MIT License
1.74k stars 182 forks source link

IOException: directory already exists in Ubuntu #195

Closed madelson closed 3 months ago

madelson commented 3 months ago

From https://ci.appveyor.com/project/madelson/distributedlock/build/job/vww7q8txqj37tj4q

Failed TestDoesNotFailDueToUnauthorizedAccessExceptionOnDirectoryCreation [32 ms]
  Error Message:
     Expected: No Exception to be thrown
  But was:  <System.InvalidOperationException: Failed to ensure that lock file directory /tmp/FileDistributedLockTest/net8.0 exists
 ---> System.IO.IOException: The file '/tmp/FileDistributedLockTest/net8.0' already exists.
   at Medallion.Threading.FileSystem.FileDistributedLock.EnsureDirectoryExists() in /_/src/DistributedLock.FileSystem/FileDistributedLock.cs:line 142
   --- End of inner exception stack trace ---
   at Medallion.Threading.FileSystem.FileDistributedLock.EnsureDirectoryExists() in /_/src/DistributedLock.FileSystem/FileDistributedLock.cs:line 150
   at Medallion.Threading.FileSystem.FileDistributedLock.TryAcquire(CancellationToken cancellationToken) in /_/src/DistributedLock.FileSystem/FileDistributedLock.cs:line 74
   at Medallion.Threading.Internal.BusyWaitHelper.WaitAsync[TState,TResult](TState state, Func`3 tryGetValue, TimeoutValue timeout, TimeoutValue minSleepTime, TimeoutValue maxSleepTime, CancellationToken cancellationToken) in /_/src/DistributedLock.Core/Internal/BusyWaitHelper.cs:line 22
   at Medallion.Threading.Internal.SyncViaAsync.Run[TState,TResult](Func`2 action, TState state) in /_/src/DistributedLock.Core/Internal/SyncViaAsync.cs:line 61
   at Medallion.Threading.Internal.DistributedLockHelpers.TryAcquire[THandle](IInternalDistributedLock`1 lock, TimeSpan timeout, CancellationToken cancellationToken) in /_/src/DistributedLock.Core/Internal/DistributedLockHelpers.cs:line 56
   at Medallion.Threading.FileSystem.FileDistributedLock.TryAcquire(TimeSpan timeout, CancellationToken cancellationToken) in /_/src/DistributedLock.FileSystem/FileDistributedLock.IDistributedLock.cs:line 32
   at Medallion.Threading.Tests.FileSystem.FileDistributedLockTest.<>c__DisplayClass19_1.<TestDoesNotFailDueToUnauthorizedAccessExceptionOnDirectoryCreation>b__2() in /home/appveyor/projects/distributedlock/src/DistributedLock.Tests/Tests/FileSystem/FileDistributedLockTest.cs:line 446
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at NUnit.Framework.Internal.TaskAwaitAdapter.NonGenericAdapter.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaitable)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.ExceptionHelper.RecordException(Delegate parameterlessDelegate, String parameterName)>
  Stack Trace:
     at Medallion.Threading.Tests.FileSystem.FileDistributedLockTest.TestDoesNotFailDueToUnauthorizedAccessExceptionOnDirectoryCreation() in /home/appveyor/projects/distributedlock/src/DistributedLock.Tests/Tests/FileSystem/FileDistributedLockTest.cs:line 457