[Twisted-Python] Perspective Broker example broken

Jean-Paul Calderone exarkun at divmod.com
Tue Jan 31 09:29:15 EST 2006

On Sun, 29 Jan 2006 15:51:25 -0800 (PST), Peter Stradinger <emlprime at yahoo.com> wrote:
>I'm trying to get the Authentication with Perspective Broker examples to work, and I'm getting a
>The server returns this error when you run the client:
>Unhandled error in Deferred:
>Traceback (most recent call last):
>Failure: twisted.spread.pb.PBConnectionLost: [Failure instance: Traceback (failure with no
>frames): twisted.internet.error.ConnectionDone: Connection was closed cleanly.
>What does this mean?

PB was doing something, and had possibly exposed a Deferred to application-level code, but suddenly the connection was lost, before a result with which to fire that Deferred could be constructed from bytes received from the network.

>It doesn't occur if I don't call reactor.stop() from the client.  Is there
>some other cleanup I have to do when shutting down the reactor from the 
>client side?

Most likely, the server's send() call has not had a chance to complete fully when the client decided to exit.  This prevents the client from sending its reply to the send() call.  The server reports exactly what happened.

You can avoid this by only disconnecting (ie, stopping the reactor) when receiving a response to a call (as opposed to doing so when you receive a call but before you respond), although this can be difficult if you have more than one thing happening at a time.

More likely, you just want to handle PBConnectionLost on the server.  In many cases, it is probably appropriate just to trap and ignore it.


More information about the Twisted-Python mailing list