[Zodb-checkins] SVN: ZODB/branches/3.7/ Added logic to avoid spurious errors from the logging system on exit.

Jim Fulton jim at zope.com
Thu Feb 15 12:20:35 EST 2007


Log message for revision 72618:
  Added logic to avoid spurious errors from the logging system on exit.
  

Changed:
  U   ZODB/branches/3.7/NEWS.txt
  U   ZODB/branches/3.7/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/branches/3.7/NEWS.txt
===================================================================
--- ZODB/branches/3.7/NEWS.txt	2007-02-15 17:17:37 UTC (rev 72617)
+++ ZODB/branches/3.7/NEWS.txt	2007-02-15 17:20:34 UTC (rev 72618)
@@ -1,4 +1,5 @@
-What's new on ZODB 3.7.0b3?
+
+What's new on ZODB 3.7.0b4?
 ===========================
 
 Packaging
@@ -19,6 +20,9 @@
 ClientStorage
 -------------
 
+- (3.7b4) Added logic to avoid spurious errors from the logging system
+  on exit.
+
 - (3.7b2) Removed the "sync" mode for ClientStorage.  
 
   Previously, a ClientStorage could be in either "sync" mode or "async"

Modified: ZODB/branches/3.7/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/branches/3.7/src/ZEO/zrpc/connection.py	2007-02-15 17:17:37 UTC (rev 72617)
+++ ZODB/branches/3.7/src/ZEO/zrpc/connection.py	2007-02-15 17:20:34 UTC (rev 72618)
@@ -12,6 +12,7 @@
 #
 ##############################################################################
 import asyncore
+import atexit
 import errno
 import select
 import sys
@@ -39,6 +40,7 @@
 client_map = {}
 client_trigger = trigger(client_map)
 client_logger = logging.getLogger('ZEO.zrpc.client_loop')
+atexit.register(client_map.clear)
 
 def client_loop():
     map = client_map
@@ -106,18 +108,26 @@
                 _exception(obj)
 
         except:
-            client_logger.critical('The ZEO cient loop failed.',
-                            exc_info=sys.exc_info())
-            for fd, obj in map.items():
-                if obj is client_trigger:
-                    continue
+            if map:
                 try:
-                    obj.mgr.client.close()
+                    client_logger.critical('The ZEO cient loop failed.',
+                                           exc_info=sys.exc_info())
                 except:
-                    map.pop(fd, None)
-                    client_logger.critical("Couldn't close a dispatcher.",
-                                           exc_info=sys.exc_info())
+                    pass
 
+                for fd, obj in map.items():
+                    if obj is client_trigger:
+                        continue
+                    try:
+                        obj.mgr.client.close()
+                    except:
+                        map.pop(fd, None)
+                        try:
+                            client_logger.critical("Couldn't close a dispatcher.",
+                                                   exc_info=sys.exc_info())
+                        except:
+                            pass
+
 client_thread = threading.Thread(target=client_loop)
 client_thread.setDaemon(True)
 client_thread.start()



More information about the Zodb-checkins mailing list