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

unblock Unix Domain Socket on Dispose on macOS #101753

Merged
merged 9 commits into from
May 22, 2024
Merged

unblock Unix Domain Socket on Dispose on macOS #101753

merged 9 commits into from
May 22, 2024

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Apr 30, 2024

fixes #101539
When. Interop.Sys.Disconnect is called on macOS with UDS, it fails and we end up in endless TryUnblockSocket loop.

We could fallback to Shutdown on any error - this is just smallest change to fix the reported issue.,
Lot of the abortive jargon around here really make sense only for TCP imho and I'm n to sure how applicable the logic is to other socket types.

@wfurt wfurt added this to the 9.0.0 milestone Apr 30, 2024
@wfurt wfurt requested review from tmds and a team April 30, 2024 23:58
@wfurt wfurt self-assigned this Apr 30, 2024
Copy link
Contributor

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

@wfurt
Copy link
Member Author

wfurt commented May 1, 2024

Note that the linked issue can also be fixed by adding Shutdown to NamedPipeClientStream's Dispose to make sure everything is written and disconnected. (or we dan perhaps do both)


try
{
client.Receive(buffer);
Copy link
Member

Choose a reason for hiding this comment

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

If there's a regression that causes TryUnblockSocket to break, the test will hang at client.Receive and never time out.

Copy link
Member

@tmds tmds May 1, 2024

Choose a reason for hiding this comment

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

We can do some things like:

await Task.WhenAny(disposeTask, socketOperation)
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
await disposeTask
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));
SocketError? localSocketError = null;
try
{
await socketOperation
.WaitAsync(TimeSpan.FromMilliseconds(TestSettings.PassingTestTimeout));

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 was thinking about it. However, I think we would notice it and fix it. XUnit now spits out warnings about long running tasks.

@wfurt wfurt merged commit 258ae79 into dotnet:main May 22, 2024
108 checks passed
@wfurt wfurt deleted the uds branch May 22, 2024 21:19
steveharter pushed a commit to steveharter/runtime that referenced this pull request May 28, 2024
* unblock Unix Domain Socket on dispose on macOS

* feedback

* feedback

* windows

* feedback
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* unblock Unix Domain Socket on dispose on macOS

* feedback

* feedback

* windows

* feedback
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2024
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.

Unable to cancel NamedPipeClientStream reads on MacOS
6 participants