martinrusev / django-redis-sessions

Session backend for Django that stores sessions in a Redis database
BSD 3-Clause "New" or "Revised" License
495 stars 106 forks source link

Improve exception handling when loading a session #62

Open gtnx opened 5 years ago

gtnx commented 5 years ago

We've recently encountered instability issues with a redis instance in our infrastructure. This generated many user unwanted disconnections but no errors were tracked server side. The problem was that we had TimeoutError when querying redis and that those errors were silently ignored by redis_sessions.

There are two methods of SessionStore which ignores the errors:

It looks a bad design to me for two reasons:

I suggest to remove those try/except as

What do you think?

gtnx commented 5 years ago

Any thoughts?

normanjaeckel commented 5 years ago

Maybe this issue is related to https://code.djangoproject.com/ticket/29203

If connection to redis timed out, django thinks the session is deleted and removes the session cookie during response. So the client is logged off although it might reload or reconnect some seconds later.

Here I would expect a HTTP 5xx.

Allan-Nava commented 3 years ago

Any news?