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

System.ObjectDisposedException: Cannot access a disposed object 'System.Threading.SemaphoreSlim' #525

Open
albertwoo opened this issue Apr 10, 2024 · 1 comment
Assignees

Comments

@albertwoo
Copy link

Description

I cannot always reproduce this, but this happens in my concurrent test code and my business code is using MemoryLockFactory from EasyCaching.Core.

System.ObjectDisposedException: Cannot access a disposed object.
  Object name: 'System.Threading.SemaphoreSlim'.
     at System.Threading.SemaphoreSlim.WaitAsync(Int32 millisecondsTimeout, CancellationToken cancellationToken)
     at EasyCaching.Core.DistributedLock.MemoryLock.LockAsync(Int32 millisecondsTimeout, CancellationToken cancellationToken)

Related code

try {
    if (await distributedLock.LockAsync(3000)) {
       ...
    }
    else {
        throw new Exception("xxx");
    }
}
finally {
    await distributedLock.ReleaseAsync();
}

Specifications

  • Provider : InMemory (version 1.9.2)
  • Interceptor : AspectCore (version 8.0.0)
  • Serializer : not use
  • System : Ubuntu20.04
@catcherwong
Copy link
Member

@albertwoo Thanks for your interest in this project.

We will take a look ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants