Describe the bug
When using RedisLockProvider with a service discovery system that periodically redistributes Redis endpoints distributed lock acquisition randomly fails with:
RedLockNet.Exceptions.RedisException: The specified endpoint is not defined
The error is intermittent — sometimes lock acquisition succeeds through the endpoint redistribution event, sometimes it fails. Pod restart always resolves the issue temporarily
To Reproduce
Steps to reproduce the behavior:
-
Deploy application using UseRedisLocking(connectionString), where Redis endpoints are redistributed dynamically by a service discovery system
-
Let the application run until a Redis endpoint redistribution event occurs
-
Observe RedLockNet.Exceptions.RedisException thrown from RedisLockProvider.AcquireLock()
-
Restart the pod — error resolves immediately
Expected behavior
[RedisLockProvider.AcquireLock()] should validate the connection state before attempting to create a distributed lock. If the cached IConnectionMultiplexer is disconnected (stale), the provider should reconnect before proceeding rather than using a zombie connection that has no valid endpoints registered in RedLock.
Currently AcquireLock() only checks if (_redlockFactory == null) but never validates _multiplexer.IsConnected.
During endpoint redistribution, StackExchange.Redis begins async background reconnection, but AcquireLock() doesn't wait — it attempts to use the still-disconnected multiplexer immediately, causing RedLock to fail with "endpoint not defined".
Additional context
WorkflowCore: 3.14.0
StackExchange.Redis: 2.8.47
.NET: 8.0
Describe the bug
When using RedisLockProvider with a service discovery system that periodically redistributes Redis endpoints distributed lock acquisition randomly fails with:
The error is intermittent — sometimes lock acquisition succeeds through the endpoint redistribution event, sometimes it fails. Pod restart always resolves the issue temporarily
To Reproduce
Steps to reproduce the behavior:
Deploy application using
UseRedisLocking(connectionString), where Redis endpoints are redistributed dynamically by a service discovery systemLet the application run until a Redis endpoint redistribution event occurs
Observe
RedLockNet.Exceptions.RedisExceptionthrown from RedisLockProvider.AcquireLock()Restart the pod — error resolves immediately
Expected behavior
[RedisLockProvider.AcquireLock()] should validate the connection state before attempting to create a distributed lock. If the cached
IConnectionMultiplexeris disconnected (stale), the provider should reconnect before proceeding rather than using a zombie connection that has no valid endpoints registered in RedLock.Currently
AcquireLock()only checks if (_redlockFactory == null) but never validates_multiplexer.IsConnected.During endpoint redistribution, StackExchange.Redis begins async background reconnection, but
AcquireLock()doesn't wait — it attempts to use the still-disconnected multiplexer immediately, causing RedLock to fail with "endpoint not defined".Additional context
WorkflowCore: 3.14.0
StackExchange.Redis: 2.8.47
.NET: 8.0