From: Yury Selivanov Date: Fri, 9 Jun 2017 23:14:35 +0000 (-0400) Subject: Break circular references when closing SSLTransport objects (#981) (#2049) X-Git-Tag: v3.6.2rc1~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe9c7a0fd3412efb7598b395e70a5a85219e2e6b;p=python Break circular references when closing SSLTransport objects (#981) (#2049) --- diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 6e9ce2968a..7948c4c3b4 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -686,12 +686,14 @@ class SSLProtocol(protocols.Protocol): self._transport._force_close(exc) def _finalize(self): + self._sslpipe = None + if self._transport is not None: self._transport.close() def _abort(self): - if self._transport is not None: - try: + try: + if self._transport is not None: self._transport.abort() - finally: - self._finalize() + finally: + self._finalize() diff --git a/Misc/NEWS b/Misc/NEWS index 7bd46d5578..213a6e9c2f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -49,6 +49,9 @@ Core and Builtins Library ------- +- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl + implementation. Patch by Michaël Sghaïer. + - bpo-29743: Closing transport during handshake process leaks open socket. Patch by Nikolay Kim