[Zope] Strange session behavior [EXPLAINED]
Andrew Athan
zope-response@memeplex.com
Fri, 31 Jan 2003 13:43:50 -0500
For those of you who are experiencing sessioning issues, I wanted to
report back to the list on my findings:
Very strange things can and will begin to happen if you refer to
sessions within your standard_error_message, or within any "top level"
exception handling code registered with Zope.
The cause seems to be in Publish.py. It does an abort(freeme=1) prior
to calling the exception handler. This means the exception handler runs
outside any transaction (as in, Transaction.py).
Apparently this hoses the session machinery, presumably because the
index[] and data[] structures are no longer guaranteed to be
synchronized to each other (as they are at transaction boundaries).
So, to avoid problems, do not refer to session variables within your
standard_error_message.
The Zope folks are looking at this abort() call; the verdict is out on
whether calling abort(freeme=1) before exception handlers are invoked is
a bug.
Andrew (I've got the bends from diving so deep) Athan
PS: I'll be putting various Zope/Python goodies at www.memeplex.com