DistributedLock
DistributedLock copied to clipboard
Redis timeout on RedLockRelease
We are sometime getting timeouts on releasing the redis lock. What's the best way to handle this so that the lock can be freed up and not stay lock forever
var redisDistributedLock = new RedisDistributedLock(lockKey, database);
await using IAsyncDisposable handle = await redisDistributedLock.AcquireAsync();
Exception:
One or more errors occurred. (Timeout awaiting response (outbound=0KiB, inbound=0KiB, 5766ms elapsed, timeout is 5000ms), command=EVAL, next: EVAL, inst: 0, qu: 0, qs: 0, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: genosha-eus.redis.cache.windows.net:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: pd0sdwk0004XD, IOCP: (Busy=1,Free=999,Min=200,Max=1000), WORKER: (Busy=7,Free=1016,Min=50,Max=1023), v: 2.2.88.56325 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)) Timeout awaiting response (outbound=0KiB, inbound=0KiB, 5766ms elapsed, timeout is 5000ms), command=EVAL, next: EVAL, inst: 0, qu: 0, qs: 0, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: genosha-eus.redis.cache.windows.net:6380, mc: 1/1/0, mgr: 10 of 10 available, clientName: pd0sdwk0004XD, IOCP: (Busy=1,Free=999,Min=200,Max=1000), WORKER: (Busy=7,Free=1016,Min=50,Max=1023), v: 2.2.88.56325 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)
System.AggregateException:
at Medallion.Threading.Redis.RedLock.RedLockRelease+<ReleaseAsync>d__3.MoveNext (DistributedLock.Redis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=12bc08512096ade0: /_/DistributedLock.Redis/RedLock/RedLockRelease.cs:78)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable+ConfiguredValueTaskAwaiter.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Medallion.Threading.Redis.RedLock.RedLockHandle+<DisposeAsync>d__9.MoveNext (DistributedLock.Redis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=12bc08512096ade0: /_/DistributedLock.Redis/RedLock/RedLockHandle.cs:52)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
... Internal code