Skip to content

ServiceStack.Redis: "Unable to Connect: sPort: 0" and Unable to cast object of type 'System.Byte[]' to type 'System.Object[]' #465

@joe-udwin-lrn

Description

@joe-udwin-lrn

I have a test harness that repeatedly gets and sets DateTime objects so we can test fail-over of our new Redis Sentinel deployment.

I have added my license key to the static constructor of the calling class.

I have not made any client configuration so it should be using the defaults.

Gets and Sets succeed 99% of the time but I am getting intermittent failures like the ones below.

  1. Unable to Connect: sPort: 0

    ServiceStack.Redis.RedisException: Unable to Connect: sPort: 0
    at ServiceStack.Redis.RedisNativeClient.CreateConnectionError()
    at ServiceStack.Redis.RedisNativeClient.SendReceive[T](Byte[][] cmdWithBinaryArgs, Func1 fn, Action1 completePipelineFn, Boolean sendWithoutRead)
    at ServiceStack.Redis.RedisNativeClient.SendExpectMultiData(Byte[][] cmdWithBinaryArgs)
    at ServiceStack.Redis.RedisNativeClient.SentinelGetMasterAddrByName(String masterName)
    at ServiceStack.Redis.RedisSentinelWorker.GetMasterHost(String masterName)

    Other posts claim this could be related to the ConnectTimeout, but we are not setting it specifically and therefore the default (-1 / not set) should be being used.
    What is the issue?

2 . Unable to cast object of type 'System.Byte[]' to type 'System.Object[]'

2016-07-15 15:00:04,825 ERROR Caching.CacheCore.RedisCacheCore - Get<T> failed with key @#qm:qmth:testhardness-3be0f6bb-5df5-4205-afe4-45ee56b59a71
2016-07-15 15:00:04,825 ERROR Tools.RedisTestHarness.Program - READ - EXCEPTION [Duration: 00:00:00.4976532]: Unable to cast object of type 'System.Byte[]' to type 'System.Object[]'.
2016-07-15 15:00:04,825 DEBUG Tools.RedisTestHarness.Program -    at System.Linq.Enumerable.<CastIterator>d__1`1.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at ServiceStack.Redis.RedisNativeClient.SentinelSlaves(String masterName)
   at ServiceStack.Redis.RedisSentinelWorker.GetSlaveHosts(String masterName)
   at ServiceStack.Redis.RedisSentinelWorker.GetSentinelInfo()
   at ServiceStack.Redis.RedisSentinel.GetSentinelInfo()
   at ServiceStack.Redis.RedisSentinel.GetRedisManager()
   at ServiceStack.Redis.RedisSentinel.GetValidSentinelWorker()
   at ServiceStack.Redis.RedisSentinel.Start()
   at Caching.CacheCore.RedisCacheCore.CreateManagerForSentinel(String connectionString, String sentinelHostFilter)
   at Caching.CacheCore.RedisCacheCore.CreateClientManager(String connectionString, Boolean useSentinel, String sentinelHostFilter)
   at Caching.CacheCore.RedisCacheCore.GetClient()
   at Caching.CacheCore.RedisCacheCore.Get[T](String key)
   at Caching.CacheCore.CacheCoreWrapper.<>c__DisplayClass1`1.<Get>b__0()
   at Caching.FunctionHandlers.ExecuteFunctionHandler.HandleFunction[T](Func`1 functionToHandle)
   at Caching.CacheCore.CacheCoreWrapper.Get[T](String key)
   at Caching.Cache.Get[T](String key)
   at Tools.RedisTestHarness.Program.Main(String[] args) in ...\Tools.RedisTestHarness\Program.cs:line 123

This makes no sense to me. Any ideas?

Both of these issues are preventing us from deploying to production.

Thanks for your help in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions