Re: Not understanding session expiration

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
On Jan 30, 2016, at 8:19 AM, Dev Erik <[email protected]> wrote:
> 
> I set my sessions expiration and cleanup to 1 minute to test it out.  I put an object into the session that opened a socket, but while the session expired, the object is still alive.  I know this because the __del__ method never got called (I put a print "object deleted" message in there and never got it) and the socket stays alive.  Also I have no other references to the object that might keep it alive.

Who did you think was going to delete it?  None of your code runs unless there is a request to be handled.  As part of that request, you might trigger a session expiration garbage collection run, but it certainly doesn’t happen asynchronously.  The object itself might not have been deleted, but any future request on that session will be directed to a new session.  THAT’S what expiration is for.

If you really need session objects to age out immediately, you’ll have to spawn a timer-based thread to age them yourself.
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.