[Zope-Checkins] SVN: Zope/trunk/lib/python/ZServer/HTTPResponse.py
Don't leak the bodyproducer if the response leaks.
Chris McDonough
chrism at plope.com
Sun Aug 29 19:46:02 EDT 2004
Log message for revision 27348:
Don't leak the bodyproducer if the response leaks.
Changed:
U Zope/trunk/lib/python/ZServer/HTTPResponse.py
-=-
Modified: Zope/trunk/lib/python/ZServer/HTTPResponse.py
===================================================================
--- Zope/trunk/lib/python/ZServer/HTTPResponse.py 2004-08-29 21:10:45 UTC (rev 27347)
+++ Zope/trunk/lib/python/ZServer/HTTPResponse.py 2004-08-29 23:46:02 UTC (rev 27348)
@@ -234,6 +234,12 @@
self.stdout.write(str(self))
if self._bodyproducer:
self.stdout.write(self._bodyproducer, 0)
+ # we assign None to self._bodyproducer below to ensure that even
+ # if self is part of a cycle which causes a leak that we
+ # don't leak the bodyproducer (which often holds a reference to
+ # an open file descriptor, and leaking file descriptors can have
+ # particularly bad ramifications for a long-running process)
+ self._bodyproducer = None
def setBody(self, body, title='', is_error=0, **kw):
""" Accept either a stream iterator or a string as the body """
More information about the Zope-Checkins
mailing list