[Zope3-checkins] SVN: Zope3/trunk/src/zope/server/ftp/tests/test_ftpserver.py Removed spurious "exception polling in loop(): " output.

Jim Fulton cvs-admin at zope.org
Fri Jun 18 11:36:07 EDT 2004


Log message for revision 25905:
Removed spurious "exception polling in loop(): " output.

Aded code to catch infinate loops (which occasionally occur for me, 
probably related to hyperthreading) and close all conections in test
servers. This will tend to cause test failures, which is good.

There is probably a bug here, but no one has time to chase it down. :(

We'll just have to limp along until we have time to switch to twisted.



-=-
Modified: Zope3/trunk/src/zope/server/ftp/tests/test_ftpserver.py
===================================================================
--- Zope3/trunk/src/zope/server/ftp/tests/test_ftpserver.py	2004-06-18 14:08:30 UTC (rev 25904)
+++ Zope3/trunk/src/zope/server/ftp/tests/test_ftpserver.py	2004-06-18 15:32:58 UTC (rev 25905)
@@ -17,6 +17,7 @@
 """
 
 import asyncore
+
 import unittest
 import socket
 from types import StringType
@@ -31,11 +32,14 @@
 
 from zope.server.tests.asyncerror import AsyncoreErrorHook
 
+from zope.server.trigger import trigger
 
+
 import ftplib
 
 from time import time
 
+
 td = ThreadedTaskDispatcher()
 
 LOCALHOST = '127.0.0.1'
@@ -111,14 +115,23 @@
         self.thread_started.set()
         import select
         from errno import EBADF
+        nerr = 0
         while self.run_loop:
             self.counter = self.counter + 1
-            # print 'loop', self.counter
             try:
                 asyncore.poll(0.1)
             except select.error, data:
                 if data[0] == EBADF:
-                    print "exception polling in loop(): ", data
+                    nerr += 1
+                    if nerr > 100:
+                        # Things are pretty bad if we got here
+                        for socket in asyncore.socket_map.values():
+                            if not isinstance(socket, trigger):
+                                try:
+                                    socket.close()
+                                except:
+                                    pass
+                        break
                 else:
                     raise
 




More information about the Zope3-Checkins mailing list