Skip to content

Commit 3d43814

Browse files
Michaël Sghaïer1st1
Michaël Sghaïer
authored andcommitted
Break circular references when closing SSLTransport objects (#981)
1 parent ff9511b commit 3d43814

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
@@ -685,12 +685,14 @@ def _fatal_error(self, exc, message='Fatal error on transport'):
685685
self._transport._force_close(exc)
686686

687687
def _finalize(self):
688+
self._sslpipe = None
689+
688690
if self._transport is not None:
689691
self._transport.close()
690692

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

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Extension Modules
5656
Library
5757
-------
5858

59+
- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl
60+
implementation. Patch by Michaël Sghaïer.
61+
5962
- bpo-29743: Closing transport during handshake process leaks open socket.
6063
Patch by Nikolay Kim
6164

0 commit comments

Comments
 (0)