Closed paladinu closed 1 year ago
Hi @paladinu, The most recent change fixes the issue here: https://github.com/Azure/aspnet-redis-providers/issues/190 Perhaps you can update your code so the session object is not null?
I have the same issue. I thnik it is because when trying to chceck if session exists in redis and redis returns null for session key data then the whole process crushes even before Session_Start event. For now i had to downgrade back to version 5.0.0
I'm not sure how I could ever guarantee that I guess. Will there be a 5.2 release soon?
Got the same problem today after upgrading,
The most recent change fixes the issue here: #190
@stanleysmall-microsoft maybe I am misunderstanding too. Do you mean the fix is to throw an exception instead of swallowing it? I would really rather it just returned null if redis returned null.
I'm seeing the same issue with 5.0.1, and have had to revert to 5.0.0.
To me it initially seems like the try/catch that was removed was also masking a different issue with the way null/expired session keys are handled in this library (as @szczenchu suggested).
Our application tries to get session data for a request, then creates a new session if the entry in HttpContext.Session[<session key>]
was null
(i.e. has expired since last access).
This works fine in the standard InProc session model, the state server approach and with v5.0.0 of this library.
With 5.0.1, once the session expires, any subsequent request throws the ArgumentNullException
mentioned by the OP, until you clear the session cookie.
To echo what @paladinu said above:
I would really rather it just returned null if redis returned null.
Same thing from our side version 5.0.1 introduce bug. We revert to version 5.0.0 and wait for correction
@paladinu @szczenchu @sur1969 @ws-markb @FranckSix Version 5.0.2 has been released with an additional null check in the serialization methods (https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider/5.0.2). Please let me know if you continue to have issues.
I had the same issue with 5.0.1 and updated to 5.0.2. Still having the issue.
Thanks for the feedback @zbarrier . I have released version 5.0.3 (https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider/5.0.3) adding the original try-catch block
Just upgraded to version 5.0.1 and now experiencing an error:
Buffer cannot be null. Parameter name: buffer
Stack Trace:
[ArgumentNullException: Buffer cannot be null. Parameter name: buffer] System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +14303443 Microsoft.Web.Redis.StackExchangeClientConnection.DeserializeSessionStateItemCollection(RedisResult serializedSessionStateItemCollection) +60 Microsoft.Web.Redis.StackExchangeClientConnection.GetSessionData(Object rowDataFromRedis) +104 Microsoft.Web.Redis.RedisConnectionWrapper.TryTakeWriteLockAndGetData(DateTime lockTime, Int32 lockTimeout, Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) +468 Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContextBase context, String id, CancellationToken cancellationToken, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) +1297 Microsoft.Web.Redis.<GetItemExclusiveAsync>d__19.MoveNext() +289 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32 Microsoft.AspNet.SessionState.<GetSessionStateItemAsync>d__74.MoveNext() +816 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62 Microsoft.AspNet.SessionState.<AcquireStateAsync>d__65.MoveNext() +829 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62 Microsoft.AspNet.SessionState.TaskAsyncHelper.EndTask(IAsyncResult ar) +58 System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +505 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +194 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +140
Upgrading looks like it added a precondition in web config:
<remove name="Session" /> <add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,managedHandler" />
Here is the sessionstate config which did not change: `
All nuget dependencies have been met so I'm a bit confused on the apparent mismatch.
Any help is appreciated.