The protocol references the transport which references the protocol.
The stream_writer has a bunch of references to the protocol which references the stream_writer
the stream_reader has a reference to the protocol which references the stream_reader.
I used weakref.finalize to print when the writer or the protocol get deleted and they don't get deleted until python is shutdown.
weakref.finalize(writer, print, "writer was deleted.")
weakref.finalize(writer._protocol, print, "protocol deleted.")
Let me organize my changes into a pull request for a fix
circular references.
The protocol references the transport which references the protocol. The stream_writer has a bunch of references to the protocol which references the stream_writer the stream_reader has a reference to the protocol which references the stream_reader.
I used
weakref.finalize
to print when the writer or the protocol get deleted and they don't get deleted until python is shutdown.Let me organize my changes into a pull request for a fix