-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[EventEngine] Support AF_UNIX for windows #34801
Conversation
@drfloob Can you review? |
Hi @youyuanwu. This feature has been in discussion for a while. In short, we need to consider whether unix sockets can be treated identically within gRPC across platforms, or if there are subtle semantic differences that require a bit more scrutiny. There are a few folks reviewing the concept now, and we'll get back with you soon. Thank you for the contribution regardless! |
The PR has been tested manually with grpc-go, which already supports AF_UNIX on windows. |
I have also done some testing of this with my own C++ server and C# client (grpc-dotnet which already supports AF_UNIX). No issues found. |
Sorry for the delay, @youyuanwu. We've gotten consensus that this seems pretty safe to implement, so we can continue with the code review. Unfortunately, I'm going to be out for the remainder of the year, so we'll have to pick it up in January, but I'll do a quick first pass today. |
src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc
Outdated
Show resolved
Hide resolved
// } | ||
// return std::string(buff.data(), len); | ||
std::string temp_dir = "C:/tmp/"; | ||
if (CreateDirectoryA(temp_dir.c_str(), NULL) == 0 && |
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.
If this implementation ends up working, we can create this directory once and return a static variable. That would let us eliminate the lambda captures below.
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.
The solution works. Changed to a const global variable. The directory is created only once now.
In future we might want to use a local directory for this test.
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.
Sorry again for the delay. This is getting closer! I've done another review, please let me know if you have any questions.
@drfloob The last test run had failures when event engine listener is turned off. I cannot see the test run links anymore and do not remember the config to turn on/off, so please rerun the pipeline again. |
I am updating this page 100 times a day, looking for the moment when the PR will be merged in production. This is a great achievement and I am looking forward to using it. |
That's great, thank you!
Very interesting! I'll look into that. Is there any test in particular that demonstrates the bug better than others?
It's running now. |
Yes. This is the symptom. The easiest repro is to create any uds client that try connect to a non-existent server. Somewhere inside "event_engine_tcp_client_connect()" has the problem. |
@youyuanwu I have a fix in the linked PR. Thanks for helping us find some bugs! |
#35892) CC @youyuanwu This fixes a lock acquisition ordering problem in WindowsEventEngine's Connect behavior, between a ConnectionState's internal mutex, and a HandshakeManager's mutex. The connection state mutex should not be held when calling the on_connected callback. This should unblock #34801 Closes #35892 COPYBARA_INTEGRATE_REVIEW=#35892 from drfloob:connect-callback-lock-cycle 4d56120 PiperOrigin-RevId: 606752276
@drfloob I rebased with master with your change. The locking issue has been fixed by your change. |
@youyuanwu Your change is merged, thanks for adding this feature! |
@drfloob Thanks for the review and help. I will leave the documentation change to you, to say that uds is no longer unix only. |
Hey, did this make it into main? |
Yes. a58f83c |
#22285
Unix domain socket has been added to windows: AF_UNIX comes to Windows
Golang net pkg has adopted this long ago:
https://go-review.googlesource.com/c/go/+/125456
https://go-review.googlesource.com/c/sys/+/132555
grpc-go already support this.
AF_UNIX on windows is seamlessly integrated with winsock API.
The modification needed are: