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

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20091223161340.81C6E94182__44765.2036943056$1261584831$gmane$org@cvs.zope.org>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.