Skip to content

Commit fe9c7a0

Browse files
authored
Break circular references when closing SSLTransport objects (#981) (#2049)
1 parent 7a16a45 commit fe9c7a0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Lib/asyncio/sslproto.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,12 +686,14 @@ def _fatal_error(self, exc, message='Fatal error on transport'):
686686
self._transport._force_close(exc)
687687

688688
def _finalize(self):
689+
self._sslpipe = None
690+
689691
if self._transport is not None:
690692
self._transport.close()
691693

692694
def _abort(self):
693-
if self._transport is not None:
694-
try:
695+
try:
696+
if self._transport is not None:
695697
self._transport.abort()
696-
finally:
697-
self._finalize()
698+
finally:
699+
self._finalize()

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Core and Builtins
4949
Library
5050
-------
5151

52+
- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl
53+
implementation. Patch by Michaël Sghaïer.
54+
5255
- bpo-29743: Closing transport during handshake process leaks open socket.
5356
Patch by Nikolay Kim
5457

0 commit comments

Comments
 (0)