tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.54k stars 2.44k forks source link

Windows UDS Support #2201

Open mattsre opened 4 years ago

mattsre commented 4 years ago

Version

Tokio version - 0.2.11

Platform

Windows 10 Pro - 1909 (November Update)

Description

I'd like to be able to use UDS on Windows with Tokio. Windows 10 introduced support for unix sockets in late 2017 to Insiders builds, and the spring 2018 general Windows 10 release. Building this functionality into Tokio allows downstream ecosystems, such as Tonic's, to use this support to enhance their own offerings and examples.

Windows UDS Support: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ Tonic reference issue: https://github.com/hyperium/tonic/issues/238

lucasyvas commented 4 years ago

Looks like the folks at Azure took a run at this, but it's likely an out of date solution now:

https://github.com/Azure/tokio-uds-windows

Darksonn commented 4 years ago

This seems like it should be added to mio first.

carllerche commented 3 years ago

Because we hid PollEvented, this is going to need some additional support. I don't know much about UDS on windows. Will it work w/ AFD (see how tcp/udp are now implemented on windows)? or does it need to go via IOCP?

johnspurlock commented 2 years ago

Just curious if there was any update on when/if this could happen. Seems to be blocking https://github.com/denoland/deno/issues/10750 over in Deno land, which I'm eagerly watching...

Noah-Kennedy commented 2 years ago

I'm interested in this as well. I'll muck about with this and see what I can come up with. This would have to start with mio, as has already been mentioned.

Darksonn commented 2 years ago

We don't currently have any plans to work on this feature, but if someone wants to figure out how it works and implement it, I would be happy to review such a PR.

elmarco commented 2 years ago

afaik, it will require changes in mio, which in turns needs std support. This might take a while. see rust-lang/rust#56533

Darksonn commented 2 years ago

Well, we managed to add named pipes on windows without std support.

Noah-Kennedy commented 2 years ago

I'm actually working on this right now.

msabansal commented 2 years ago

@Noah-Kennedy any updates on this? Are you still working on it?

Noah-Kennedy commented 2 years ago

I will get back to this and finish it soon.

Hobbit44 commented 2 years ago

@Noah-Kennedy Any news? Im really looking forward to some downstream uses of this.

Noah-Kennedy commented 2 years ago

I have still not gotten around to this unfortunately.

sullivan-sean commented 2 years ago

I have a PR for mio support here https://github.com/tokio-rs/mio/pull/1610 and if that is upstreamed it should be pretty easy to add to tokio.

I have a first pass here https://github.com/sullivan-sean/tokio built on the above PR to mio that seems to be working. It could definitely be cleaned up a bit (lots of code reuse between unix and windows) but I've been able to use this in cross-platform projects already

KolbyML commented 1 year ago

sullivan-sean stopped work on his PR so I decided to picked up the torch.

Here is the current https://github.com/tokio-rs/mio/pull/1667 PR it addresses most if not all of the concerns outlined with the original PR. I will support the PR as long as it takes, After that I will look into making a PR for tokio

tensor-programming commented 1 year ago

@KolbyML do you need any help here? I was working on an independent implementation for ockam's uds library. I basically just ripped parts out of the azure repos and rewrote them to mirror Mio and Tokio's Unix implementations. The issue I ran into though, is that Tokio no longer exposes the PollEvented type; I could have tried to use something like tokio-reactor but that didn't seem like an elegant solution.

I'd like to help give a shot in the arm, so that we can get this into Tokio and Mio. I can start in on the Tokio version since the Mio PR seems finished. Or is there something else holding this up?

KolbyML commented 1 year ago

Hi @tensor-programming I believe I resolved Thomasdezeeuw concerns with the original PR. I think the main thing now is community interest maybe? Also since it is a relatively big PR it might take sometime before core maintainers have time to review it.

So far I haven't heard any push back from core maintainers of Tokio, but I also haven't seen much interest in it yet as well. So I hope in the future we do get the support we need. I did try to shoot a message to Thomasdezeeuw 3 weeks ago, if he had interest in reviewing it in the next few months or if there were some kind of hard blocker and I haven't heard back on that yet.

Mio also has a very slow release schedule. So first a release would need to be made then Tokio would have to update so it seems to me like a long play. After that release was made I think it would then be the opportunity to work on it for Tokio.

So who knows hopefully the message you sent lights a spark! 🎇 I will be waiting patiently and hoping for the best since I think getting support for this would be fantastic!

localhosted commented 1 year ago

I can't build Deno on Windows because of this error: cannot find type 'UnixStream' in module 'tokio::net, afaik adding UDS should make it possible to build tokio?

tensor-programming commented 1 year ago

No problem, I understand. Just lending my time if it was needed. I just noticed that things seemed like they had stalled. Seems I was wrong in that assumption. Fell of the map anyhow for a couple of months due to personal reasons. Ill keep an eye on the progress here in the meantime.