[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/zrpc/trigger.py It turns out the fix for the file-descriptor leak was only relevent to

Jim Fulton jim at zope.com
Wed Dec 23 11:13:40 EST 2009


Log message for revision 107016:
  It turns out the fix for the file-descriptor leak was only relevent to
  Python 2.6, where asyncore.file_wrapper was changed to dup it's the
  file-descriptor passed to it. :(  Fixed the fix to work withor or not
  the fd is duped.
  

Changed:
  U   ZODB/trunk/src/ZEO/zrpc/trigger.py

-=-
Modified: ZODB/trunk/src/ZEO/zrpc/trigger.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/trigger.py	2009-12-23 16:04:06 UTC (rev 107015)
+++ ZODB/trunk/src/ZEO/zrpc/trigger.py	2009-12-23 16:13:39 UTC (rev 107016)
@@ -140,8 +140,14 @@
             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)
+            if self.fd != r:
+                # Starting in Python 2.6, the descriptor passed to
+                # file_dispatcher gets duped and assigned to
+                # self.fd. This breals the instantiation semantics and
+                # is a bug imo.  I dount it will get fixed, but maybe
+                # it will. Who knows. For that reason, we test for the
+                # fd changing rather than just checking the Python version.
+                os.close(r)
 
         def _close(self):
             os.close(self.trigger)



More information about the Zodb-checkins mailing list