1

We have a web application which uses Microsoft.Web.Redis.RedisSessionStateProvider as the session state provider. We've had no problems with this until recently when suddenly the application is reporting a large number of exceptions as detailed below.

The message suggests some kind of timeout. But I've no idea how to resolve this. The application is an instance of Kentico CMS and we haven't customised its session caching mechanism in any way.

Main exception:

Message:

Exception of type 'System.Web.HttpException' was thrown.

Stack Trace:

at System.Web.HttpAsyncResult.End() 
at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) 

Inner exception:

Message:

Timeout performing EVAL, inst: 1, mgr: Inactive, err: never, queue: 0, qu: 0, qs: 0, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, IOCP: (Busy=0,Free=1000,Min=2,Max=1000), WORKER: (Busy=3,Free=32764,Min=2,Max=32767), clientName: KSCOMAZUATWEB2

Stack Trace:

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 1927 
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 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 866 
at Microsoft.Web.Redis.StackExchangeClientConnection.<>c__DisplayClass4.<Eval>b__3() in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 113 
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryForScriptNotFound(Func`1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 129 
at Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func`1 redisOperation) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 155 
at Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in d:\TeamCityBuildAgent\work\f55792526e6d9089\src\Shared\StackExchangeClientConnection.cs:line 113 
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.PollLockedSessionCallback(Object state) 

2 Answers 2

2

After experiencing the same issue and having read various posts on setting min & max thread values etc, it transpired that the issue was with the subscription tier.

C1 basic (£35/GBP mth) boasts a 1gb cache, 1000 concurrent connections which are exactly the same headline figures as the C1 Standard tier (£95GBP/Mth). It's a natural assumption that when you only require a few MB of cache and have only 50 concurrent sessions active at any point, that the C! basic would be adequate, if not overkill.

The difference seems to be that C1 Basic works, if you have 10 or less concurrent users on your website. In fairness, it is mentioned in the fine print that the basic is only suitable for development and testing environments.

1
  • we have C1 standard .. active sessions are 9-10 .. still constantly getting timeout .. its very annoying .. none of the solution is working.
    – NMathur
    Mar 20, 2018 at 6:33
1

I was just working through this on a client site and what helped me was to add this to the connection string of your provider:

throwOnError="true" retryTimeoutInMilliseconds="500"

What I learned is sometimes there is a latency issue and if it doesn't resolve fast enough the default is to just "quit". So adding this allows it to continue to retry.

Your string might look like this

<add name="MySessionStateStore" throwOnError="true" retryTimeoutInMilliseconds="500" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="mysite-prod.redis.cache.windows.net" accessKey="mykey" ssl="true" />
4
  • Amazing, thanks Brenden. I will give this a try and get back to you. Sep 2, 2016 at 15:57
  • Sadly, still occurring :( Sep 2, 2016 at 16:13
  • 1
    I've been reading this - azure.microsoft.com/en-gb/blog/… - which prompted me to investigate CPU usage on our web server. Looks like it's intermittently hitting 100% (something I'll have to investigate separately) but these peaks could be correlated with the redis errors so for now I'm assuming this is a side-effect of a different issue. Sep 2, 2016 at 16:26
  • Also take a look at caching. If you're site is still cached in Kentico and/or Redis, you may need to clear it out in order to see a change. In the Redis console run FLUSHDB to clear out the session cache. It could also be an issue with your smart search. Check out my post here: kehrendev.com/blog/brenden-kehren/may-2016/… Sep 2, 2016 at 16:43

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.