[Zodb-checkins] SVN: ZODB/trunk/src/ POSKeyErrors are really client errors
Jim Fulton
jim at zope.com
Thu Dec 18 09:45:10 EST 2008
Log message for revision 94170:
POSKeyErrors are really client errors
Changed:
U ZODB/trunk/src/CHANGES.txt
U ZODB/trunk/src/ZEO/tests/testZEO.py
U ZODB/trunk/src/ZEO/zrpc/connection.py
-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt 2008-12-18 13:21:58 UTC (rev 94169)
+++ ZODB/trunk/src/CHANGES.txt 2008-12-18 14:45:10 UTC (rev 94170)
@@ -32,6 +32,9 @@
- You can now control whether FileStorages keep .old files when packing.
+- POSKeyErrors are no longer logged by ZEO servers, because they are
+ really client errors.
+
3.9.0a8 (2008-12-15)
====================
Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py 2008-12-18 13:21:58 UTC (rev 94169)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py 2008-12-18 14:45:10 UTC (rev 94170)
@@ -13,53 +13,43 @@
##############################################################################
"""Test suite for ZEO based on ZODB.tests."""
-# System imports
+from ZEO.ClientStorage import ClientStorage
+from ZEO.tests.forker import get_port
+from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests
+from ZEO.tests import IterationTests
+from ZEO.zrpc.error import DisconnectedError
+from ZODB.tests import StorageTestBase, BasicStorage, \
+ TransactionalUndoStorage, \
+ PackableStorage, Synchronization, ConflictResolution, RevisionStorage, \
+ MTStorage, ReadOnlyStorage, IteratorStorage, RecoveryStorage
+from ZODB.tests.MinPO import MinPO
+from ZODB.tests.StorageTestBase import zodb_unpickle
+from ZODB.tests.testDemoStorage import DemoStorageWrappedBase
+
import asyncore
import doctest
import logging
import os
+import persistent
+import shutil
import signal
import stat
import tempfile
import threading
import time
+import transaction
import unittest
-import shutil
-
-# ZODB test support
import ZEO.ServerStub
+import ZEO.StorageServer
+import ZEO.tests.ConnectionTests
+import ZEO.zrpc.connection
import ZODB
import ZODB.blob
+import ZODB.tests.testblob
import ZODB.tests.util
-import ZODB.tests.testblob
-from ZODB.tests.MinPO import MinPO
-from ZODB.tests.StorageTestBase import zodb_unpickle
-import persistent
-import transaction
+import ZODB.utils
import zope.testing.setupstack
-# ZODB test mixin classes
-from ZODB.tests import StorageTestBase, BasicStorage, \
- TransactionalUndoStorage, \
- PackableStorage, Synchronization, ConflictResolution, RevisionStorage, \
- MTStorage, ReadOnlyStorage, IteratorStorage, RecoveryStorage
-
-from ZODB.tests.testDemoStorage import DemoStorageWrappedBase
-
-from ZEO.ClientStorage import ClientStorage
-
-from ZEO.zrpc.error import DisconnectedError
-
-import ZEO.zrpc.connection
-
-from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests, \
- IterationTests
-from ZEO.tests.forker import get_port
-
-import ZEO.tests.ConnectionTests
-
-import ZEO.StorageServer
-
logger = logging.getLogger('ZEO.tests.testZEO')
class DummyDB:
@@ -1150,7 +1140,23 @@
>>> db.close()
"""
+def dont_log_poskeyerrors_on_server():
+ """
+ >>> addr, admin = start_server()
+ >>> import ZEO.ClientStorage
+ >>> cs = ZEO.ClientStorage.ClientStorage(addr)
+ >>> cs.load(ZODB.utils.p64(1))
+ Traceback (most recent call last):
+ ...
+ POSKeyError: 0x01
+ >>> cs.close()
+ >>> stop_server(admin)
+ >>> 'POSKeyError' in open('server-%s.log' % addr[1]).read()
+ False
+ """
+
+
slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests,
DemoStorageTests, FileStorageTests, MappingStorageTests,
Modified: ZODB/trunk/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/connection.py 2008-12-18 13:21:58 UTC (rev 94169)
+++ ZODB/trunk/src/ZEO/zrpc/connection.py 2008-12-18 14:45:10 UTC (rev 94170)
@@ -27,6 +27,7 @@
from ZEO.zrpc.trigger import trigger
from ZEO.zrpc.log import short_repr, log
from ZODB.loglevels import BLATHER, TRACE
+import ZODB.POSException
REPLY = ".reply" # message name used for replies
ASYNC = 1
@@ -377,6 +378,9 @@
# sends Z303 to server
# OK, because Z303 is in the server's clients_we_can_talk_to
+ # Exception types that should not be logged:
+ unlogged_exception_types = ()
+
# Client constructor passes 'C' for tag, server constructor 'S'. This
# is used in log messages, and to determine whether we can speak with
# our peer.
@@ -569,8 +573,9 @@
except (SystemExit, KeyboardInterrupt):
raise
except Exception, msg:
- self.log("%s() raised exception: %s" % (name, msg), logging.INFO,
- exc_info=True)
+ if not isinstance(msg, self.unlogged_exception_types):
+ self.log("%s() raised exception: %s" % (name, msg),
+ logging.INFO, exc_info=True)
error = sys.exc_info()[:2]
return self.return_error(msgid, flags, *error)
@@ -780,6 +785,9 @@
class ManagedServerConnection(Connection):
"""Server-side Connection subclass."""
+ # Exception types that should not be logged:
+ unlogged_exception_types = (ZODB.POSException.POSKeyError, )
+
# Servers use a shared server trigger that uses the asyncore socket map
trigger = trigger()
More information about the Zodb-checkins
mailing list