mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 09:46:18 +00:00
tidy up DeadReferenceError handling, ignore them in add_lease calls
Stop checking separately for ConnectionDone/ConnectionLost, since those have been folded into DeadReferenceError since foolscap-0.3.1 . Write rrefutil.trap_deadref() in terms of rrefutil.trap_and_discard() to improve code coverage.
This commit is contained in:
parent
222148eaee
commit
bacb6fe5aa
@ -104,6 +104,8 @@ class Checker(log.PrefixingLogMixin):
|
||||
# particular we want to log any local errors caused by coding
|
||||
# problems.
|
||||
|
||||
if f.check(DeadReferenceError):
|
||||
return
|
||||
if f.check(RemoteException):
|
||||
if f.value.failure.check(KeyError, IndexError, NameError):
|
||||
# this may ignore a bit too much, but that only hurts us
|
||||
|
@ -756,6 +756,8 @@ class ServermapUpdater:
|
||||
# particular we want to log any local errors caused by coding
|
||||
# problems.
|
||||
|
||||
if f.check(DeadReferenceError):
|
||||
return
|
||||
if f.check(RemoteException):
|
||||
if f.value.failure.check(KeyError, IndexError, NameError):
|
||||
# this may ignore a bit too much, but that only hurts us
|
||||
|
@ -10,7 +10,6 @@ from twisted.application import service
|
||||
from twisted.application.internet import TimerService
|
||||
from zope.interface import implements
|
||||
from foolscap.api import eventually, DeadReferenceError, Referenceable, Tub
|
||||
from twisted.internet.error import ConnectionDone, ConnectionLost
|
||||
|
||||
from allmydata.util import log
|
||||
from allmydata.interfaces import RIStatsProvider, RIStatsGatherer, IStatsProducer
|
||||
@ -218,7 +217,7 @@ class StatsGatherer(Referenceable, service.MultiService):
|
||||
# this is called lazily, when a get_stats request fails
|
||||
del self.clients[tubid]
|
||||
del self.nicknames[tubid]
|
||||
f.trap(DeadReferenceError, ConnectionDone, ConnectionLost)
|
||||
f.trap(DeadReferenceError)
|
||||
|
||||
def log_client_error(self, f, tubid):
|
||||
log.msg("StatsGatherer: error in get_stats(), peerid=%s" % tubid,
|
||||
|
@ -4,7 +4,6 @@ from cStringIO import StringIO
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import defer
|
||||
from twisted.internet import threads # CLI tests use deferToThread
|
||||
from twisted.internet.error import ConnectionDone, ConnectionLost
|
||||
import allmydata
|
||||
from allmydata import uri
|
||||
from allmydata.storage.mutable import MutableShareFile
|
||||
@ -262,7 +261,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
||||
self.fail("interrupted upload should have failed, not finished"
|
||||
" with result %s" % (res,))
|
||||
def _interrupted(f):
|
||||
f.trap(ConnectionLost, ConnectionDone, DeadReferenceError)
|
||||
f.trap(DeadReferenceError)
|
||||
|
||||
# make sure we actually interrupted it before finishing the
|
||||
# file
|
||||
|
@ -22,5 +22,4 @@ def trap_and_discard(f, *errorTypes):
|
||||
pass
|
||||
|
||||
def trap_deadref(f):
|
||||
f.trap(DeadReferenceError)
|
||||
pass
|
||||
return trap_and_discard(f, DeadReferenceError)
|
||||
|
Loading…
x
Reference in New Issue
Block a user