This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
make sure we close OS handle if socket is finalized without disposing #38499
Merged
+5
−9
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
tmds
reviewed
Jun 13, 2019
tmds
approved these changes
Jun 13, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
stephentoub
reviewed
Jun 13, 2019
src/System.Net.Sockets/tests/FunctionalTests/DisposedSocketTests.netcoreapp.cs
Outdated
Show resolved
Hide resolved
stephentoub
approved these changes
Jun 13, 2019
stephentoub
approved these changes
Jun 14, 2019
I want back and it behaves as you described @stephentoub. I guess I got confused somewhere early and I modified test and never got back to original form. |
/azp run corefx-outerloop-linux |
Azure Pipelines successfully started running 1 pipeline(s). |
System.IO.Tests failure is unrelated. |
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…dotnet/corefx#38499) * socket_finalize_37044 * update test Commit migrated from dotnet/corefx@23faf5d
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If socket is finalized without disposing we currently leak OS socket as Dispose(false) does nothing.
With this change, socket finalizer should nuke OS fd.
I originally forked CloseAsIs() but it seems like disposing _handle is sufficient.
The test @stephentoub wrote give me some grief.
It seems like EventLoop() can hold reference to SocketAsyncContext until new event kicks in.
I decided to explicitly drop that so we are more likely to release handle if finalize socket but there is no other activity for a while.
fixes dotnet/runtime#29327