Commit 82a63bb0 authored by Jim Fulton's avatar Jim Fulton

POSKeyErrors are really client errors

parent efe06091
...@@ -32,6 +32,9 @@ New Features ...@@ -32,6 +32,9 @@ New Features
- You can now control whether FileStorages keep .old files when packing. - 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) 3.9.0a8 (2008-12-15)
==================== ====================
......
...@@ -13,53 +13,43 @@ ...@@ -13,53 +13,43 @@
############################################################################## ##############################################################################
"""Test suite for ZEO based on ZODB.tests.""" """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 asyncore
import doctest import doctest
import logging import logging
import os import os
import persistent
import shutil
import signal import signal
import stat import stat
import tempfile import tempfile
import threading import threading
import time import time
import transaction
import unittest import unittest
import shutil
# ZODB test support
import ZEO.ServerStub import ZEO.ServerStub
import ZEO.StorageServer
import ZEO.tests.ConnectionTests
import ZEO.zrpc.connection
import ZODB import ZODB
import ZODB.blob import ZODB.blob
import ZODB.tests.util
import ZODB.tests.testblob import ZODB.tests.testblob
from ZODB.tests.MinPO import MinPO import ZODB.tests.util
from ZODB.tests.StorageTestBase import zodb_unpickle import ZODB.utils
import persistent
import transaction
import zope.testing.setupstack 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') logger = logging.getLogger('ZEO.tests.testZEO')
class DummyDB: class DummyDB:
...@@ -1150,6 +1140,22 @@ def history_over_zeo(): ...@@ -1150,6 +1140,22 @@ def history_over_zeo():
>>> db.close() >>> 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 = [ slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests, BlobAdaptedFileStorageTests, BlobWritableCacheTests,
......
...@@ -27,6 +27,7 @@ from ZEO.zrpc.marshal import Marshaller ...@@ -27,6 +27,7 @@ from ZEO.zrpc.marshal import Marshaller
from ZEO.zrpc.trigger import trigger from ZEO.zrpc.trigger import trigger
from ZEO.zrpc.log import short_repr, log from ZEO.zrpc.log import short_repr, log
from ZODB.loglevels import BLATHER, TRACE from ZODB.loglevels import BLATHER, TRACE
import ZODB.POSException
REPLY = ".reply" # message name used for replies REPLY = ".reply" # message name used for replies
ASYNC = 1 ASYNC = 1
...@@ -377,6 +378,9 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -377,6 +378,9 @@ class Connection(smac.SizedMessageAsyncConnection, object):
# sends Z303 to server # sends Z303 to server
# OK, because Z303 is in the server's clients_we_can_talk_to # 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 # Client constructor passes 'C' for tag, server constructor 'S'. This
# is used in log messages, and to determine whether we can speak with # is used in log messages, and to determine whether we can speak with
# our peer. # our peer.
...@@ -569,8 +573,9 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -569,8 +573,9 @@ class Connection(smac.SizedMessageAsyncConnection, object):
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
raise raise
except Exception, msg: except Exception, msg:
self.log("%s() raised exception: %s" % (name, msg), logging.INFO, if not isinstance(msg, self.unlogged_exception_types):
exc_info=True) self.log("%s() raised exception: %s" % (name, msg),
logging.INFO, exc_info=True)
error = sys.exc_info()[:2] error = sys.exc_info()[:2]
return self.return_error(msgid, flags, *error) return self.return_error(msgid, flags, *error)
...@@ -780,6 +785,9 @@ class Connection(smac.SizedMessageAsyncConnection, object): ...@@ -780,6 +785,9 @@ class Connection(smac.SizedMessageAsyncConnection, object):
class ManagedServerConnection(Connection): class ManagedServerConnection(Connection):
"""Server-side Connection subclass.""" """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 # Servers use a shared server trigger that uses the asyncore socket map
trigger = trigger() trigger = trigger()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment