TheCloudlessSky / Harbour.RedisSessionStateStore

A Redis based SessionStateStoreProvider written in C# using ServiceStack.Redis.
MIT License
166 stars 76 forks source link

Random Logout #27

Closed shorttp closed 9 years ago

shorttp commented 9 years ago

Hi Adrian,

I'm not sure if this is a Harbour Redis specific issue. I've hooked up Harbour Redis and it is working. However, for some users, they randomly get logged out of the application. When I view the Redis CLI, the data for their redis session gets wiped out. We are storing the following in Session (I'm mostly using the HttpContext.Current.Session):

We did have an issue with Telerik reports wherein they were storing data in the session, but it was raw data and was not being converted into the byte array format Redis is expecting. I managed to create a workaround such that it would not be an issue.

In terms of Redis, are there any limitations or gotcha's that one needs to worry about when using Session? Is there something that I may not be aware of?

Note: I am using the MS OpenTech version of Redis

Thank you!

TheCloudlessSky commented 9 years ago

Hey @shorttp,

The users being logged out shouldn't have much to do with the RedisSessionStateStore since the session is independent of the authentication state (unless you're manually calling Session.Abandon() somewhere). Are you checking if the Session exists anywhere and then logging out? Is this MVC or WebForms? Why type of authentication are you using?

In terms of how it's all stored, this library uses straight binary serialization (which of course isn't ideal, my other Redis-based projects allow you to customize the serializer).

To debug the issue, try adding some production logging during on the Session.End event and see what's triggering it (Stack trace etc.)

PS - You may also want to consider switching to Microsoft's Redis SessionStateProvider since it's identical (and most people have moved to it for better support).

shorttp commented 9 years ago

Hey Adrian,

Thanks for the response! I really appreciate the help you've given so far! Answer to your questions: