[Twisted-Python] Timeout with pb callRemote

Allen Bierbaum abierbaum at gmail.com
Mon Jan 18 16:06:36 EST 2010

I just tracked down a bug in one of our servers that uses twisted PB.
The long and short of it was that the server made remote calls to
clients that connected in and in some cases those clients would fall
off the network (disconnected network cable, etc) but the server would
not detect this.

I tracked this down to TCP timeouts not telling twisted rapidly enough
that the clients were offline.  What I was going to use to solve this
was to put a timeout on the remoteCall() by calling setTimeout on the
deferred returned when making the call.  Then if the deferred does not
fire soon enough I could treat this as a dead client detection and
clean up it's resources.

The problem is that it looks like Deferred.setTimeout is deprecated.
(see: http://twistedmatrix.com/trac/browser/tags/releases/twisted-9.0.0/twisted/internet/defer.py#L350)

Is there some other suitable way to set a timeout on a remoteCall when using PB?


More information about the Twisted-Python mailing list