8

I have an intermittent error which shows up in my code. When I debug it using Visual Studio, with break on all exceptions (caught & uncaught) it doesn't break, so I'm not sure what to do.

It looks like it's the session state provider from the stack trace, here is the config:

<sessionState mode="Custom" customProvider="RedisSessionProvider">
  <providers>
    <add name="RedisSessionProvider" type="Microsoft.Web.Redis.RedisSessionStateProvider" port="6380" host="2asdasdasdasd.redis.cache.windows.net" accessKey="2asdasdasdasd=" ssl="true" />
  </providers>
</sessionState>

I installed StackExchange.Redis from NuGet, I'm runnning 1.0.297. I'm unable to reproduce this regularly, I've tried a variety of browsers and operating systems, and it just happens "sometimes".

Here is the stack trace:

Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) +246
   Microsoft.Web.Redis.RedisConnectionWrapper.Set(ISessionStateItemCollection data, Int32 sessionTimeout) +60
   Microsoft.Web.Redis.RedisSessionStateProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +802
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +565
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Faraday
  • 2,904
  • 3
  • 23
  • 46
  • 1
    The one thing I'm not seeing in the stack-trace: StackExchange.Redis; it *looks* like it is erroring in the Microsoft code; now, it is *possible* that this is due to inlining, but - on the surface, I'd have to say this is an issue for the MS folks; I've glanced at the affected method in reflector, and there are plenty of places that could go crazy; I suggest reporting this (citing this question, since it has stacktrace etc) via the "Contact Owners" link on NuGet: https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider/ – Marc Gravell Jul 10 '14 at 11:24
  • 1
    side observations: the MS code doesn't seem to gracefully handle `keyArgs`, `valueArgs`, or any element in `valueArgs` being `null`, but there's also a metric ton of reflection going on in that method for what I can only assume are "reasons" – Marc Gravell Jul 10 '14 at 11:26
  • @MarcGravell - Thanks for the tip, and extra info... I've contacted them via the link you gave me. I'll post back here when they get in touch! :) – Faraday Jul 10 '14 at 11:30
  • Can you find out if while debugging other versions of libraries are invoked? Are there other differences between runtime and debug environment? Can't you see the slightest correlations with the steps you do in your app and the error? (Just suggesting.) – peter_the_oak Jul 10 '14 at 11:39
  • @peter_the_oak - This happens so intermittently that it happens once every 100+ runs of the application. I wrote a PS script to rerun the same EXE over and over (so NOTHING changed) and it can reproduce the error, but again, randomly. – Faraday Jul 10 '14 at 11:40

0 Answers0