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

Jim Fulton jim at zope.com
Thu Feb 15 15:09:37 EST 2007


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

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

-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt	2007-02-15 20:07:54 UTC (rev 72629)
+++ ZODB/trunk/NEWS.txt	2007-02-15 20:09:36 UTC (rev 72630)
@@ -35,7 +35,7 @@
   use from a few kilobytes to at least multiple hundred megabytes.
 
 
-What's new on ZODB 3.7.0b3?
+What's new on ZODB 3.7.0b4?
 ===========================
 
 Packaging
@@ -56,6 +56,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/trunk/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/connection.py	2007-02-15 20:07:54 UTC (rev 72629)
+++ ZODB/trunk/src/ZEO/zrpc/connection.py	2007-02-15 20:09:36 UTC (rev 72630)
@@ -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