Opened 10 years ago

Closed 10 years ago

#8155 closed (worksforme)

Random session timeouts when setting request.set_expiry(0)

Reported by: danjac Owned by: nobody
Component: contrib.sessions Version: master
Severity: Keywords: session, timeouts
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Latest Django trunk ((0, 97, 'pre')), Debian latest stable, Apache2, MySQL, Python 2.5.

We have been experiencing random logouts (session timeouts) on our web application ( Users experience on average several logouts every day.

This seems to be down to two reasons:

  1. Calling request.session.set_expiry(0), i.e. to end the session when the user's browser is closed. Setting this to a set time in seconds seemed to solve this issue, but it appears that using this setting can somehow interfere with session timeouts.
  1. KeepAlive? "off" or a low KeepAliveTimeout? (1-5 seconds). We would like to reduce KeepAliveTimeout? in order to improve server performance, unfortunately this again seems to have caused the random session timeout problem to reappear.

Change History (1)

comment:1 Changed 10 years ago by Jacob

Resolution: worksforme
Status: newclosed

I've not seen this happen, personally. A couple things to double-check:

  • Is your session backend evicting sessions for some reason? If you're using memcached, this could be the case.
  • Do you have some sort of intermediary proxy interfering? The fact that varying KeepAlive changes the behavior strongly points to a proxy or something else external to Django.

I suspect that this isn't a Django bug: the fact that modifying Apache's conf changes the behvior strongly points to a web server and/or proxy configuration problem. Changing these parameters in theory shouldn't affect Django at all.

Because of that I'm going to close this ticket. However, please feel free to reopen (preferably with more information, if you've got it) after investigating further -- I'm not completely confident ruling out a bug in Django here.

Note: See TracTickets for help on using tickets.
Back to Top