3
votes

I'm getting random exceptions using the ServiceStack.Redis client on an Azure Application Service. Any thoughts?

ServiceStack.Redis 4.5.0 and ServiceStack 4.0.60.0

"ExceptionMessage": "Unknown reply on integer response: 43OK", "StackTrace": " at ServiceStack.Redis.RedisNativeClient.ReadLong()\r\n at ServiceStack.Redis.RedisNativeClient.SendReceive[T](Byte[][] cmdWithBinaryArgs, Func1 fn, Action1 completePipelineFn, Boolean sendWithoutRead)\r\n at ServiceStack.Redis.RedisNativeClient.SendExpectLong(Byte[][] cmdWithBinaryArgs)\r\n at ServiceStack.Redis.RedisNativeClient.Del(Byte[] key)\r\n at ServiceStack.Redis.RedisClient.Remove(String key)\r\n at ServiceStack.ServiceExtensions.RemoveSession(IRequest httpReq, String sessionId)\r\n at ServiceStack.Auth.CredentialsAuthProvider.Authenticate(IServiceBase authService, IAuthSession session, String userName, String password, String referrerUrl)\r\n at ServiceStack.Auth.CredentialsAuthProvider.Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)\r\n at ServiceStack.Auth.AuthenticateService.Authenticate(Authenticate request, String provider, IAuthSession session, IAuthProvider oAuthConfig)\r\n at ServiceStack.Auth.AuthenticateService.Post(Authenticate request)\r\n at lambda_method(Closure , Object , Object )\r\n at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)"

1
I managed to solve the issue by using the RedisManagerPool. - mjj

1 Answers

4
votes

This is typically due to a race condition from sharing the same Redis Client instance across multiple threads. You can share a singleton instance of ServiceStack.Redis Thread-safe Client Managers but you shouldn't share instances of Redis Client across multiple threads.