[Twisted-Python] Circular references in TLSMemoryBIOProtocol
Glyph
glyph at twistedmatrix.com
Fri Jan 19 23:07:04 MST 2018
> On Jan 19, 2018, at 11:52 AM, Ilya Skriblovsky <ilyaskriblovsky at gmail.com> wrote:
>
> > Protocols and transports have a fairly defined lifecycle, and as L. Daniel Burr already pointed out, it would probably be appropriate to explicitly break these reference cycles in connectionLost.
>
> Explicitly breaking cycle in ProtocolWrapper.connectionLost by any of:
> • self.wrappedProtocol = None
> • self.wrappedProtocol.transport = None
> • self.wrappedProtocol = weakref.proxy(self.wrappedProtocol)
> • self.wrappedProtocol.transport = weakref.proxy(self)
>
> ... breaks some existing tests :(
>
> Seems like these tests do some post-run checks against protocol instances and their transports. Not sure whether it is relevant to real-life usage.
> Will investigate more...
>
> - Ilya
Do these tests fail if you only do it in TLSMemoryBIOProtocol instead of WrapperProtocol?
If so, this may be worth a compatibility exception.
-g
More information about the Twisted-Python
mailing list