tokio icon indicating copy to clipboard operation
tokio copied to clipboard

Windows UDS Support

Open mattsre opened this issue 5 years ago • 19 comments

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

mattsre avatar Jan 30 '20 19:01 mattsre

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

lucasyvas avatar Apr 11 '20 23:04 lucasyvas

This seems like it should be added to mio first.

Darksonn avatar Jul 28 '20 08:07 Darksonn

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?

carllerche avatar Oct 24 '20 17:10 carllerche

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...

johnspurlock avatar Oct 09 '21 23:10 johnspurlock

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.

Noah-Kennedy avatar Oct 10 '21 00:10 Noah-Kennedy

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.

Darksonn avatar Oct 10 '21 07:10 Darksonn

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

elmarco avatar Feb 02 '22 18:02 elmarco

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

Darksonn avatar Feb 03 '22 06:02 Darksonn

I'm actually working on this right now.

Noah-Kennedy avatar Feb 04 '22 00:02 Noah-Kennedy

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

msabansal avatar Apr 11 '22 17:04 msabansal

I will get back to this and finish it soon.

Noah-Kennedy avatar Apr 12 '22 21:04 Noah-Kennedy

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

hobbit44 avatar Jun 02 '22 10:06 hobbit44

I have still not gotten around to this unfortunately.

Noah-Kennedy avatar Jun 05 '22 21:06 Noah-Kennedy

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

sullivan-sean avatar Aug 16 '22 19:08 sullivan-sean

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

KolbyML avatar May 04 '23 18:05 KolbyML

@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?

tensor-programming avatar May 25 '23 20:05 tensor-programming

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!

KolbyML avatar May 26 '23 01:05 KolbyML

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?

localhosted avatar Jun 19 '23 11:06 localhosted

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.

tensor-programming avatar Jul 03 '23 04:07 tensor-programming