[mod_python] Re: R: Session instances can't be stored in req?

StianSøiland stian at soiland.no
Fri Nov 7 14:43:51 EST 2003

On 2003-11-07 12:23:34, Manera, Villiam wrote:

> this hang apache
> if I delete the attribut from req all work fine:
> def check(req):
> 	if hasattr(req,'sess'):
> 		sess = req.sess
> 		delattr(req,'sess')
> 	else:
> 		sess = Session(req)
> 	return
> class BaseSession(dict):
> 	...
> 	def __del__(self):
>         self.unlock()
> the del unlock apache

Yes, a lock problem seems to be the issue here. 

We tried defining a cleanuphandler to fix things up by both calling
unlock() and removing the reference req.session - but the cleanuphandler
isn't always reached.

We tried moving the code away to a normal handler that first retrieves
the session, stores it in req.session, and then calls
mod_python.publisher.handler(req) - lock problems still occur.

> where have you put the  fixuphandler(req) and who call it? I'm interisting
> in it too

>From our library, by setting in htaccess "PythonFixupHandler
Cerebrum.web.fixup" it will be imported from

Stian Søiland               Work toward win-win situation. Win-lose
Trondheim, Norway           is where you win and the other lose.
http://www.soiland.no/      Lose-lose and lose-win are left as an
                            exercise to the reader.  [Limoncelli/Hogan]

More information about the Mod_python mailing list