[mod_python] Circular references starting from the request objectare not collected

Nicolas Lehuen nicolas at lehuen.com
Fri Sep 10 19:43:42 EDT 2004


Grisha wrote :
> On Fri, 10 Sep 2004, Nicolas Lehuen wrote:
> 
> > Meanwhile, manually deleting the reference in a finally 
> block at the 
> > end of the handler does the trick...
> 
> Keep in mind that doing it at the end of the handler won't 
> always work, as handler's execution can be aborted in the 
> middle if, for exampe, the client decides to suddenly 
> disconnect. This is exactly why Apache has cleanups - 
> cleanups run even if the handler errored out and is aborted.

I wrote my cleanup code like this :

def handler(req):
	# do something dirty
	# do another dirty thing
	try:
		# do usefull work
	finally:
		# cleanup the mess

Can the finally block be interrupted by Apache ? Do I really need to
implement cleanups instead ?

Concerning the circular reference fix, I'm switching to the python-dev
mailing list.

Regards,

Nicolas Lehuen



More information about the Mod_python mailing list