Skip to content

unblock Unix Domain Socket on Dispose on macOS#101753

Merged
wfurt merged 9 commits intodotnet:mainfrom
wfurt:uds
May 22, 2024
Merged

unblock Unix Domain Socket on Dispose on macOS#101753
wfurt merged 9 commits intodotnet:mainfrom
wfurt:uds

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 a team and tmds April 30, 2024 23:58
@wfurt wfurt self-assigned this Apr 30, 2024
@dotnet-policy-service
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
@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