[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/test_ftpserver.py Merged from trunk 25905:

Jim Fulton jim at zope.com
Fri Jul 2 15:24:27 EDT 2004


Log message for revision 26054:
Merged from trunk 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/branches/ZopeX3-3.0/src/zope/server/ftp/tests/test_ftpserver.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/test_ftpserver.py	2004-07-02 19:20:23 UTC (rev 26053)
+++ Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/tests/test_ftpserver.py	2004-07-02 19:24:27 UTC (rev 26054)
@@ -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