No connection is available to service this operation - PhysicalBridge stuck in state ConnectedEstablishing
We use StackExchange.Redis in an asp.net application. On one of the webservers, we occasionally (every couple of days) get into a state where all Key requests result in an exception like:
No connection is available to service this operation
Exception information:
Exception type: RedisConnectionException
Exception message: No connection is available to service this operation: EVAL
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1737
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81
at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 864
at Microsoft.Web.Redis.StackExchangeClientConnection.<>c__DisplayClass4.<Eval>b__3() in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\Shared\StackExchangeClientConnection.cs:line 100
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryForScriptNotFound(Func`1 redisOperation) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\Shared\StackExchangeClientConnection.cs:line 118
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func`1 redisOperation) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\Shared\StackExchangeClientConnection.cs:line 142
at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\Shared\StackExchangeClientConnection.cs:line 100
at Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\RedisSessionStateProvider\RedisConnectionWrapper.cs:line 167
at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 256
at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in c:\TeamCity\buildAgent\work\e3a19c24ba052c76\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 174
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The server never recovers from this state and a restart of the apppool is required.
Analyzing a server dump in WinDbg/Sos we have found that we seem to run into ConnectionMultiplxer:1785 TryPushMessageToBridge returning false. In line 1585 in method TryPushMessageToBridge server.IsConnected is false. Reason is that the ServerEndPoint.interactive PhysicalBridge is in state 1 (ConnectedEstablishing) never reaching either ConnectedEstablished nor Disconnected. failConnectCount is 1.
From the other exceptions in the dump, it looks like we beforehand get the errors
UnableToResolvePhysicalConnection on GET
and
SocketFailure on PING
I guess the failure then happens during the connection reestablishment attempt.
We had some network issues on the server before, which would explain an occasional dropped connection, but we expected the connection to be automatically re-established in this case. Is this assumption correct?
If so, we are no sure how to debug this further, any advice?
We're using version 1.0.414 Thanks
I am not sure if it is related, but I just noticed a possibly-similar issue with one of our deployments. We have 3 redis-instances, 1 master and 2 slaves. Both slaves were offline for the whole duration. The application using StackExchange.Redis booted, but seemed to have stopped during ConnectionMultiplexer.Connect, although at least the master was able to handle the connect and AbortOnConnectFail was set to false. I would expect StackExchange.Redis to just use the one connection until the other servers (hopefully) go online later.
We have 1 master and 1 slave that we suspect are under provisioned memory wise. We noticed that if the connection with the slave fails(it rejects info commands because the slave is loading data, this takes awhile since the machine is swapping), commands begin timing out. The timeout's continue until we get the error mentioned above. The affected machine recovers quickly but it keeps happening. All our reads and writes are against the master, so a failure to connect to the slave shouldn't affect the commands against the master right? We planning to add more memory to the Redis servers and see if that helps. Any suggestions you could provide on provisioning a Linux box for Redis would be appreciated. In addition if you could clarify how the multiplexer directs requests to slaves and masters and how a failure to process a request on the slave might effect a connected multiplexer. Regards
We fixed quicker timeouts a while ago after reproing similar circumstances at Stack, is anyone still hitting similar behavior with slave outages in a current build?
@NickCraver do you mean 1.1.533 release?
@aensidhe 1.1.572 now (more fixes), but yes...recent code :)
Hello,
As per the feedback given by @NickCraver , we have upgraded latest StackExchange libraray "StackExchange.Redis.StrongName 1.1.603".
But our problem still exists. We are getting the following message randomly.
Error Details:
Message: No connection is available to service this operation: EVAL
StackTrace::
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in C:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1968 at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in C:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81 at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in C:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 884 at Microsoft.Web.Redis.StackExchangeClientConnection.<>c__DisplayClass4.1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 135 at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 159 at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 117 at Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisConnectionWrapper.cs:line 182 at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 272 at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 190 at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Please help.
Hi all, we have the same problem in our production environment (1 Master and 1 Slave; ASP.NET application). We update the dll StackExchange.Redis.StringName to 1.1.608.0 version but our problem still exist.
Exception type: RedisConnectionException
Exception message: No connection is available to service this operation: EVAL
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1857
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 80
at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) in c:\TeamCity\buildAgent\work\3ae0647004edff78\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 886
at Microsoft.Web.Redis.StackExchangeClientConnection.<>c__DisplayClass4.1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 137
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 161
at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 119
at Microsoft.Web.Redis.RedisConnectionWrapper.UpdateExpiryTime(Int32 timeToExpireInSeconds) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisConnectionWrapper.cs:line 90
at Microsoft.Web.Redis.RedisSessionStateProvider.ResetItemTimeout(HttpContext context, String id) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 298
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Can someone please help?
Thanks
Just some more details about this issue.
We avoid this problem using this type of configuration in the Web.config:
<sessionState mode="Custom" customProvider="RedisSessionStateStore">
<providers>
<add name="RedisSessionStateStore"
type="Microsoft.Web.Redis.RedisSessionStateProvider"
host="#redis"
port="6379"
databaseId="1"
accessKey=""
ssl="false"
throwOnError = "false"
abortConnect = "false"
connectionTimeoutInMilliseconds = "10000"
operationTimeoutInMilliseconds = "5000"
retryTimeoutInMilliseconds = "15000" />
</providers>
</sessionState>
We have increased the connectionTimeoutInMilliseconds and the retryTimeoutInMilliseconds / operationTimeoutInMilliseconds.
We also set the dependentAssembly of StackExchange.Redis.StrongName into the assemblyBinding in Web.config:
<dependentAssembly>
<assemblyIdentity name="StackExchange.Redis.StrongName" publicKeyToken="c219ff1ca8c2ce46" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.608.0" newVersion="1.1.608.0" />
</dependentAssembly>
Hope this help.
We are using exact configuration in web config, yet fails to connect. Getting below error. Can any one please help?
Exception type: RedisServerException
Exception message: Endpoint x.x.x.x:7001 serving hashslot 12743 is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect.
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server)
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server)
at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags)
at Microsoft.Web.Redis.StackExchangeClientConnection.<>c__DisplayClass10_0.1 redisOperation) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 138
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func1 redisOperation) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 162
at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 120
at Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) in D:\BuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisConnectionWrapper.cs:line 185
at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in D:\BuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 276
at Microsoft.Web.Redis.RedisSessionStateProvider.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in D:\BuildAgent\work\f55792526e6d9089\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:line 190
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Having the same issue. ASP.NET. Version: 1.1.605. All azure instances co-located with azure redis. Using defaults for all timeouts (ssl=True,abortConnect=False).
Once in a while one of the servers would get into broken state and it won't heal itself.
I'm seeing the same thing
0: No connection is available to service this operation: GET DEN_ViewUpdateBag; UnableToConnect on AirportIOs.redis.cache.windows.net:6379/Interactive, origin: ResetNonConnected, input-buffer: 0, outstanding: 0, last-read: 5s ago, last-write: 5s ago, unanswered-write: -1072274s ago, keep-alive: 60s, pending: 0, state: Connecting, last-heartbeat: never, last-mbeat: -1s ago, global: 0s ago, mgr: Inactive, err: never; IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=3,Free=32764,Min=1,Max=32767), Local-CPU: n/a StackExchange.Redis.RedisConnectionException Source: StackExchange.Redis Data Collection redis-command => GET DEN_ViewUpdateBag ------------------------- request-sent-status => WaitingToBeSent ------------------------- Inner Exceptions ============================================================================= UnableToConnect on AirportIOs.redis.cache.windows.net:6379/Interactive, origin: ResetNonConnected, input-buffer: 0, outstanding: 0, last-read: 5s ago, last-write: 5s ago, unanswered-write: -1072274s ago, keep-alive: 60s, pending: 0, state: Connecting, last-heartbeat: never, last-mbeat: -1s ago, global: 0s ago, mgr: Inactive, err: never | Source: | ExceptionType:StackExchange.Redis.RedisConnectionException Data Collection Redis-FailureType => UnableToConnect ------------------------- Redis-EndPoint => AirportIOs.redis.cache.windows.net:6379 ------------------------- Redis-Origin => ResetNonConnected ------------------------- Redis-Input-Buffer => 0 ------------------------- Redis-Outstanding-Responses => 0 ------------------------- Redis-Last-Read => 5s ago ------------------------- Redis-Last-Write => 5s ago ------------------------- Redis-Unanswered-Write => -1072274s ago ------------------------- Redis-Keep-Alive => 60s ------------------------- Redis-Pending => 0 ------------------------- Redis-Previous-Physical-State => Connecting ------------------------- Redis-Last-Heartbeat => never ------------------------- Redis-Last-Multiplexer-Heartbeat => -1s ago ------------------------- Redis-Last-Global-Heartbeat => 0s ago ------------------------- Redis-SocketManager-State => Inactive ------------------------- Redis-Last-Error => never ------------------------- ******************************************************************************* Stack Trace at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisDatabase.StringGet(RedisKey key, CommandFlags flags) at FlightwiseApi.Caching.CacheLazy.GetJson(Lazy1 connectionMultiplexer, String key) in C:\src\acme\tfs\FlyByNight\Api\FlightwiseApi\Caching\CacheLazy.cs:line 79`
Is anyone seeing this in 1.2.6+, I'm trying to isolate which connection issues are still remaining.
Closing; please see #871