m3047 / tcp_only_forwarder

TCP-Only DNS Forwarder
Apache License 2.0
4 stars 3 forks source link

Tasks are WeakRefs #3

Closed m3047 closed 1 year ago

m3047 commented 1 year ago

It wasn't documented in Python 3.6 but the event loop keeps track of Tasks using a weakref.WeakSet. Theoretically this can cause tasks to mysteriously disappear during garbage collection.

So, special measures need to be taken to keep a regular reference to the task around while a request is being serviced.