[Zodb-checkins] CVS: ZODB3/ZEO/zrpc - marshal.py:1.6 error.py:1.4 connection.py:1.36
Jeremy Hylton
jeremy@zope.com
Wed, 25 Sep 2002 18:28:10 -0400
Update of /cvs-repository/ZODB3/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv15469/zrpc
Modified Files:
marshal.py error.py connection.py
Log Message:
Fix error handling logic for pickling errors.
If an exception occurs while decoding a message, there is really
nothing the server can do to recover. If the message was a
synchronous call, the client will wait for ever for the reply. The
server can't send the reply, because it couldn't unpickle the message
id. Instead of trying to recover, just let the exception propogate up
to asyncore where the connection will be closed.
As a result, eliminate DecodingError and special case in
handle_error() that handled flags == None.
=== ZODB3/ZEO/zrpc/marshal.py 1.5 => 1.6 ===
--- ZODB3/ZEO/zrpc/marshal.py:1.5 Fri Sep 13 02:00:59 2002
+++ ZODB3/ZEO/zrpc/marshal.py Wed Sep 25 18:28:10 2002
@@ -18,7 +18,7 @@
import zLOG
-from ZEO.zrpc.error import ZRPCError, DecodingError
+from ZEO.zrpc.error import ZRPCError
from ZEO.zrpc.log import log
class Marshaller:
@@ -50,8 +50,8 @@
try:
return unpickler.load() # msgid, flags, name, args
except (self.errors, IndexError), err_msg:
- log("can't decode %s" % repr(msg), level=zLOG.ERROR)
- raise DecodingError(msg)
+ log("can't decode message: %s" % repr(msg), level=zLOG.ERROR)
+ raise
_globals = globals()
_silly = ('__doc__',)
=== ZODB3/ZEO/zrpc/error.py 1.3 => 1.4 ===
--- ZODB3/ZEO/zrpc/error.py:1.3 Fri Aug 30 17:41:35 2002
+++ ZODB3/ZEO/zrpc/error.py Wed Sep 25 18:28:10 2002
@@ -17,8 +17,5 @@
class ZRPCError(POSException.StorageError):
pass
-class DecodingError(ZRPCError):
- """A ZRPC message could not be decoded."""
-
class DisconnectedError(ZRPCError, Disconnected):
"""The database storage is disconnected from the storage server."""
=== ZODB3/ZEO/zrpc/connection.py 1.35 => 1.36 ===
--- ZODB3/ZEO/zrpc/connection.py:1.35 Wed Sep 25 18:12:08 2002
+++ ZODB3/ZEO/zrpc/connection.py Wed Sep 25 18:28:10 2002
@@ -20,7 +20,7 @@
import ThreadedAsync
from ZEO.zrpc import smac
-from ZEO.zrpc.error import ZRPCError, DisconnectedError, DecodingError
+from ZEO.zrpc.error import ZRPCError, DisconnectedError
from ZEO.zrpc.log import log, short_repr
from ZEO.zrpc.marshal import Marshaller
from ZEO.zrpc.trigger import trigger
@@ -188,13 +188,11 @@
def message_input(self, message):
"""Decoding an incoming message and dispatch it"""
- # XXX Not sure what to do with errors that reach this level.
- # Need to catch ZRPCErrors in handle_reply() and
- # handle_request() so that they get back to the client.
- try:
- msgid, flags, name, args = self.marshal.decode(message)
- except DecodingError, msg:
- return self.return_error(None, None, DecodingError, msg)
+ # If something goes wrong during decoding, the marshaller
+ # will raise an exception. The exception will ultimately
+ # result in asycnore calling handle_error(), which will
+ # close the connection.
+ msgid, flags, name, args = self.marshal.decode(message)
if __debug__:
log("recv msg: %s, %s, %s, %s" % (msgid, flags, name,
@@ -276,9 +274,6 @@
self.poll()
def return_error(self, msgid, flags, err_type, err_value):
- if flags is None:
- self.log_error("Exception raised during decoding")
- return
if flags & ASYNC:
self.log_error("Asynchronous call raised exception: %s" % self)
return