[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope-cvs
Subject:    [Zope-Checkins] SVN: Zope/trunk/lib/python/ZServer/HTTPResponse.py
From:       Chris McDonough <chrism () plope ! com>
Date:       2004-08-29 23:46:02
Message-ID: 20040829234602.977FE203085 () mail ! zope ! org
[Download RAW message or body]

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 """

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic