You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connection objects currently stay alive and open if they are not
explicitly closed or terminated. GC won't happen to them because event
loops have a strong reference to their underlying Transport object.
By replacing a strong Connection<->Protocol reference with a weak one,
we are able to implement Connection.__del__() method that:
* issues a warning if a Connection object is being GCed prior
to be explicitly closed;
* terminates the underlying Protocol and Transport, effectively closing
the open network connection to the Postgres server.
When in asyncio debug mode (enabled by PYTHONASYNCIODEBUG env variable
or explicitly with `loop.set_debug(True)`) Connection objects save the
traceback of their origin and later use it to make the GC warning
clarer.
Addresses #323.
0 commit comments