diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 367f7d07a4184a..79e0745a75256a 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -478,7 +478,11 @@ def connection_lost(self, exc): self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + if getattr(self, '_handshake_timeout_handle', None): + self._handshake_timeout_handle.cancel() self._wakeup_waiter(exc) + self._app_protocol = None + self._sslpipe = None def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Misc/NEWS.d/next/Library/2019-03-17-16-43-29.bpo-34745.nOfm7_.rst b/Misc/NEWS.d/next/Library/2019-03-17-16-43-29.bpo-34745.nOfm7_.rst new file mode 100644 index 00000000000000..d88f36a6d21736 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-17-16-43-29.bpo-34745.nOfm7_.rst @@ -0,0 +1 @@ +Fix :mod:`asyncio` ssl memory issues caused by circular references