[Zodb-checkins] SVN: ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py Fixed file-descriptor leak, owing to fd duping.

Jim Fulton jim at zope.com
Mon Sep 21 16:58:32 EDT 2009


Log message for revision 104412:
  Fixed file-descriptor leak, owing to fd duping.
  

Changed:
  U   ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py

-=-
Modified: ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py
===================================================================
--- ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py	2009-09-21 20:58:29 UTC (rev 104411)
+++ ZODB/branches/jim-thready-zeo2/src/ZEO/zrpc/trigger.py	2009-09-21 20:58:31 UTC (rev 104412)
@@ -137,13 +137,15 @@
 
         def __init__(self, map=None):
             _triggerbase.__init__(self)
-            r, self.trigger = self._fds = os.pipe()
+            r, self.trigger = os.pipe()
             asyncore.file_dispatcher.__init__(self, r, map)
 
+            # file_dispatcher dups r, so we don't need it any more
+            os.close(r)
+
         def _close(self):
-            for fd in self._fds:
-                os.close(fd)
-            self._fds = []
+            os.close(self.trigger)
+            asyncore.file_dispatcher.close(self)
 
         def _physical_pull(self):
             os.write(self.trigger, 'x')



More information about the Zodb-checkins mailing list