Skip to content

Conversation

@tmds
Copy link
Member

@tmds tmds commented Feb 1, 2022

By replacing the raw handle with a Socket, we ensure only the handle
we own gets used.

By using the Socket async APIs we no longer need a dedicated Thread
to synchronously read the events.

Fixes #64319, #64441.

cc @ManickaP @wfurt @vdjuric

By replacing the raw handle with a Socket, we ensure only the handle
we own gets used.

By using the Socket async APIs we no longer need a dedicated Thread
to synchronously read the events.
@ghost ghost added area-System.Net community-contribution Indicates that the PR has been added by a community member labels Feb 1, 2022
@ghost
Copy link

ghost commented Feb 1, 2022

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

Issue Details

By replacing the raw handle with a Socket, we ensure only the handle
we own gets used.

By using the Socket async APIs we no longer need a dedicated Thread
to synchronously read the events.

Fixes #64319, #64441.

cc @ManickaP @wfurt @vdjuric

Author: tmds
Assignees: -
Labels:

area-System.Net

Milestone: -

}

s_socket.Dispose();
s_socket = null;
Copy link
Member

@wfurt wfurt Feb 16, 2022

Choose a reason for hiding this comment

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

We check under lock if s_socket == null in few places. Is there chance somebody may pick up disposed Socket there?
It seems like it would be better to reset s_socket before disposing to force fresh creation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add some Debug.Assert that verify things are properly guarded.

@wfurt
Copy link
Member

wfurt commented Feb 16, 2022

It seems like we lost test to look for runaway work. I don't know if there is any good way how to do that now but it would be nice.

It also would be nice to add test that aggressively adds and removes handlers in parallel. It seems like this is where lot if the hard part lives and it may be worth of stressing that code.

@tmds
Copy link
Member Author

tmds commented Feb 21, 2022

It seems like we lost test to look for runaway work. I don't know if there is any good way how to do that now but it would be nice.

Because we are no longer using blocking APIs the need for a test that verifies we are not blocking a Thread or the ThreadPool is gone.

@karelz karelz added this to the 7.0.0 milestone Feb 22, 2022
@karelz karelz assigned stephentoub and unassigned wfurt Feb 22, 2022
@stephentoub stephentoub merged commit 26c5e72 into dotnet:main Feb 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetworkAddressChange.Unix can start reading from unrelated handles.

7 participants