Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_SSLProtocolTransport keeps reference to protocol after close #98539

Closed
kumaraditya303 opened this issue Oct 22, 2022 · 1 comment
Closed

_SSLProtocolTransport keeps reference to protocol after close #98539

kumaraditya303 opened this issue Oct 22, 2022 · 1 comment
Assignees
Labels
3.11 3.12 expert-asyncio type-bug An unexpected behavior, bug, or error

Comments

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Oct 22, 2022

_SSLProtocolTransport keeps reference to protocol after close. It leads to reference cyeles between the transport and the protocol and is bad for gc. Clearing this is better as it frees up the memory immediately without waiting for the gc. This causes memory leaks in some cases as if an exception occurs the deallocation is delayed even further as tracebacks keeps ref to frame and frame keeps locals alive.

def close(self):
"""Close the transport.
Buffered data will be flushed asynchronously. No more data
will be received. After all buffered data is flushed, the
protocol's connection_lost() method will (eventually) called
with None as its argument.
"""
self._closed = True
self._ssl_protocol._start_shutdown()

@kumaraditya303 kumaraditya303 added type-bug An unexpected behavior, bug, or error expert-asyncio 3.11 3.12 labels Oct 22, 2022
@kumaraditya303 kumaraditya303 self-assigned this Oct 22, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 22, 2022
…ythonGH-98540)

(cherry picked from commit 62bf5d8)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
@kumaraditya303
Copy link
Contributor Author

kumaraditya303 commented Oct 22, 2022

Fixed by #98540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 3.12 expert-asyncio type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

1 participant