You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resource leak in TcpChannel when opening and closing TCP Proxies. #90
In TcpChannel we found that opening and closing TCP Proxies between client and server would leak resources
on the Gen2 heap that were never reclaimed. We have an application that grew to a run-time foot-print of 5 Gb! Running Redgate ANTS memory profiler found a set of objects that were being retained in Gen2 due to a number of references related to the SocketAsyncEventArgs. In the changes, each step in this was able to finally get a flat memory profile when making and breaking connections between client and server.
Resolved for 6.0.1. TcpChannel connection setup now detaches the SocketAsyncEventArgs.Completed handler, clears socket/endpoint references, and disposes the event arguments in a finally block. The client socket is also disposed when connection setup throws. This breaks the retained completion/resource graph described in the report. Added a targeted test that verifies the connection event resources take the cleanup path on both supported test targets.
Activity
tylerje commentedon Apr 4, 2024
Love it. Submit the PR and I'll run some tests locally and if everything checks out, I'll get a new version of the package out asap.
scottcnevin commentedon Apr 8, 2024
Tyler -- not really sure what to do at this point. I opened the PR and made the changes. Not sure how to "submit" the PR at this point on github.
authlogics#1
tylerje commentedon Apr 8, 2024
@scottcnevin the PR you created and referenced is into your own fork. As such, I cannot approve that PR nor would it land in the origin in my repo. See the doc:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork
tylerje commentedon Aug 18, 2026
Resolved for 6.0.1.
TcpChannelconnection setup now detaches theSocketAsyncEventArgs.Completedhandler, clears socket/endpoint references, and disposes the event arguments in afinallyblock. The client socket is also disposed when connection setup throws. This breaks the retained completion/resource graph described in the report. Added a targeted test that verifies the connection event resources take the cleanup path on both supported test targets.