Skip to content

Conversation

@stephentoub
Copy link
Member

There's still a lot more, but most of it appears to be inevitable given the current design and public APIs in the library, e.g. SslStreamCertificateContext creating resources it internally stores and not providing any way to explicitly clean them up.

Some of the changes here are in production code in System.Security.Cryptography and System.Net.Security, but the majority are in tests.

There's still a lot more, but most of it appears to be inevitable given the current design and public APIs in the library, e.g. SslStreamCertificateContext creating resources it internally stores and not providing any way to explicitly clean them up.
@stephentoub stephentoub requested review from bartonjs and wfurt July 14, 2022 15:13
@ghost ghost assigned stephentoub Jul 14, 2022
@ghost
Copy link

ghost commented Jul 14, 2022

Tagging subscribers to this area: @dotnet/ncl, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

There's still a lot more, but most of it appears to be inevitable given the current design and public APIs in the library, e.g. SslStreamCertificateContext creating resources it internally stores and not providing any way to explicitly clean them up.

Some of the changes here are in production code in System.Security.Cryptography and System.Net.Security, but the majority are in tests.

Author: stephentoub
Assignees: -
Labels:

area-System.Net.Security

Milestone: -

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Is there some trick how to find all lingering safe handles or this is mostly based on code inspection? I'm wondering if it would be possible to automate this somehow....

@stephentoub
Copy link
Member Author

Is there some trick how to find all lingering safe handles or this is mostly based on code inspection? I'm wondering if it would be possible to automate this somehow....

I added instrumentation to SafeHandle earlier in the week. Do a debug or checked build of the runtime, e.g. .\build clr+libs -rc checked, and then set the DEBUG_SAFEHANDLE_INITIALIZATION environment variable to "1". It'll log to the console all SafeHandles that get finalized, including the stack from when/where they were constructed.

@stephentoub stephentoub merged commit 32f5873 into dotnet:main Jul 15, 2022
@stephentoub stephentoub deleted the netsecurityhandles branch July 15, 2022 19:20
@karelz karelz added this to the 7.0.0 milestone Jul 19, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants