[mod_python] Sessions and cleaning up...

Krishna Srinivasan krishna at ironport.com
Fri May 28 19:44:36 EDT 2004


Greetings.

Can someone please explain how exactly sessions are cleaned up ?
I am seeing a constant increase in the /tmp/mp_sess.dbm though
I believe I am doing a 'delete' (and cleanup).

For each session, whenever a user does some action (which internally
involves creating objects and storing them in the session dictionary),
I do a "req.sess.save".
[Where req.sess = Session.Session()]

And then when they do a 'logout' - I do this :
req.sess.delete()
req.sess.invalidate()

I am assuming that the former cleans up the session-object from
the dbm in the /tmp directory and the latter invalidates the
session-cookie-id from the headers (from the modpy online doc).

However,  the size of mp_sess.dbm in /tmp is on the rise
always. Can someone please tell me what else I should be doing ?

I store everything in a simple dictionary.
req.sess["mydict"] = <mydictionary>
The 'mydictionary' object keeps expanding based on user-actions.
I even do a 'del' to remove objects from this 'mydictionary'
object to keep the space down.

I am also wondering if setting up sess.set_timeout() number
has any impact on the dmb being cleaned up or updated. I
would think 'sess.delete' and/or 'sess.invalidate' would
over-ride timeout-value-set.

On a related note, I had posted a question couple of days
back on if there was any max limit for session timeouts
and if that has any impacts.

System - FreeBSD 4.7 - Apache 2.0.48 - Python 2.2.3 - ModPy 3.1.3

Please let me know how to fix this.

Thanks,
Krishna.



More information about the Mod_python mailing list