Commit 7cdf0f2b authored by Jim Fulton's avatar Jim Fulton

storea is asynchronous and was, therefore, never supposed to return or

raise an exception. It should catch and serialize exceptions raised by
the underlying storage, however, unpicklable exceptions could cause it
to accidentally raise an exception. We now pickle exceptions more
carefully, catching and handling pickling errors.
parent b57d55e2
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__version__ = "$Revision: 1.16 $"[11:-2] __version__ = "$Revision: 1.17 $"[11:-2]
import asyncore, socket, string, sys, cPickle, os import asyncore, socket, string, sys, cPickle, os
from smac import SizedMessageAsyncConnection from smac import SizedMessageAsyncConnection
...@@ -418,8 +418,16 @@ class Connection(SizedMessageAsyncConnection): ...@@ -418,8 +418,16 @@ class Connection(SizedMessageAsyncConnection):
else: else:
if serial != '\0\0\0\0\0\0\0\0': if serial != '\0\0\0\0\0\0\0\0':
self.__invalidated.append((oid, version)) self.__invalidated.append((oid, version))
self.message_output('s'+dump((oid,newserial), 1)) try: r=dump((oid,newserial), 1)
except:
# We got a pickling error, must be because the
# newserial is an unpicklable exception.
r=StorageServerError("Couldn't pickle exception %s" % `newserial`)
dump('',1) # clear pickler
r=dump((oid, r),1)
self.message_output('s'+r)
return _noreturn return _noreturn
def vote(self, id): def vote(self, id):
......
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