[Twisted-Python] Unjellying and circular references?

Jean-Paul Calderone exarkun at twistedmatrix.com
Fri Dec 11 07:04:49 MST 2020


On Fri, Dec 11, 2020 at 8:19 AM Jasper Phillips <jasperisjaded at gmail.com>
wrote:

> I'm using perspective broker to transfer objects in a networked game,
> which I'm having trouble unjellying -- the remote versions wind up with
> dangling twisted.persisted.crefutil._Dereference instances, so don't match
> the original objects.
>

Hi!

I'd strongly suggest you switch to a different protocol.  HTTP is quite
capable.  It has some annoying corners but you can avoid them if you
control the client and the server.  If you really want a Twisted-originated
protocol, AMP is a much better choice than PB.  It offers a little bit more
functionality than HTTP without going to the extreme complexity of PB (I am
not going to try to explain those complexities here, I'm just offering my
personal conclusion based on 20 years of experience developing and/or using
Twisted).

This is not to say that PB is the wrong choice for all applications ... but
probably almost all.


> I'm seeing this for objects that have circular references to each other.
> I've refactored things to mostly avoid circular references and sidestep
> this, but have one remaining case where I find circular references mean
> clearer code that I'm reluctant to refactor.
>
> Is there some trick I'm missing to avoid _Dereferences?
>

No, it's supposed to Just Work™ so you've found a bug in some part of the
implementation.  If you can produce a minimal reproducing example then it
may be worth a bug report.  But after that, I'd suggest investigating HTTP
or AMP as a replacement for PB.

Jean-Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20201211/5f253b6d/attachment.htm>


More information about the Twisted-Python mailing list