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

POSKeyErrors are really client errors

parent efe06091
......@@ -32,6 +32,9 @@ New Features
- 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)
====================
......
......@@ -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.util
import ZODB.tests.testblob
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle
import persistent
import transaction
import ZODB.tests.util
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,6 +1140,22 @@ def history_over_zeo():
>>> 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,
......
......@@ -27,6 +27,7 @@ from ZEO.zrpc.marshal import Marshaller
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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
# 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 @@ class Connection(smac.SizedMessageAsyncConnection, object):
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 Connection(smac.SizedMessageAsyncConnection, object):
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()
......
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