在RedisTypedClient上使用BlockingDequeue時,我看到的是超時異常。來自BlockingDequeue的RedisResponseException
調用代碼看起來像
using (var client = ClientPool.GetClient())
return client.As<TMessage>().Lists[_channel].BlockingDequeue(timeout);
凡超時設置爲0,ClientPool是PooledRedisClientManager。
堆棧跟蹤看起來像
ServiceStack.Redis.RedisResponseException: No more data, sPort: 51100, LastCommand:
at ServiceStack.Redis.RedisNativeClient.CreateResponseError(String error)
at ServiceStack.Redis.RedisNativeClient.ReadMultiData()
at ServiceStack.Redis.RedisNativeClient.SendExpectMultiData(Byte[][] cmdWithBinaryArgs)
at ServiceStack.Redis.RedisNativeClient.BRPop(String listId, Int32 timeOutSecs)
at ServiceStack.Redis.Generic.RedisTypedClient`1.BlockingDequeueItemFromList(IRedisList`1 fromList, Nullable`1 timeOut)
at ServiceStack.Redis.Generic.RedisClientList`1.BlockingDequeue(Nullable`1 timeOut)
從我能找到,這是與客戶保持打開的連接的問題。我認爲這應該通過使用PooledRedisClientManager來解決,但它似乎仍然會發生。這個問題很容易重現。只需調用BlockingDequeue方法並等待大約2-3分鐘,並拋出異常。