-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
WASI: expand networking functions #70
Comments
I think this one is pretty well documented: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-capabilities.md#berkeley-socket-rules And more from cloudabi on the issue with just providing As an example cloudabi uses flower to solve this issue: https://github.com/NuxiNL/flower |
@maxmcd When Red Hat initially evaluated CloudABI, that was one of the primary reasons we rejected it. |
Ah, interesting. Would love to hear more thoughts on why the approach is problematic. Naively it seems elegant enough to hand a program a connection to a db and worry about nothing else. |
@maxmcd It can never work for a self-healing, distributed cluster. It can never work for any kind of proxy except for the most limited one with predefined connections. The list of things it can't do is pretty endless. CloudABI was an ABI defined for a narrow use case. I'm really hoping WASI isn't. It is perfectly legitimate for a particular implementation of WASI to return |
Ah. I asked the proxy question to @EdSchouten recently:
Fair enough though that with access to |
@maxmcd Your runtime assumes communication between the host and the WASM code. Ours doesn't. The flower model can work in your use case, but it can't in ours. |
Yes, networking is a part of the API that we've not done much work on yet. I agree that it's desirable to support more than just preopened sockets from the runtime. I'm optimistic that it'll be feasible to create capabilities that represent address/port/protocol/etc. sets that an application is permitted to create sockets with, however it's obviously going to take work to flesh out all the details. |
@sunfishcode While the BSD socket API isn't great, there are a lot of applications and libraries written to it. Whatever we do, we should make sure applications can be trivially compiled for the new APIs. |
Yeah this is definitely a huge bottleneck for the https://github.com/assemblyscript/node project which aims to use wasi for HTTP, TCP, and UDP stuff. What was the latest news on this standard? I'm dying to create a socket from wasi and get a wapm installable mud server going. |
At the moment, we're still working on putting together a template for making new API proposals, with WebAssembly/WASI#74 as one of the key pieces. Once that's in place, it will be possible for people to start making proposals, and I know some folks are already prototyping network APIs that could be proposed. |
WASM would make a great Agent based system where messages are passed between agents. Networking is required for this concept. I can think of different ugly ways to do the networking. One way I would like to see an "insecure" versions on sockets, just for concept development. There are two parts to the system, one is the wasm code that would contain network functions. and the vm/engine that would allow/deny socket sysCalls. Only on a system that has both parts could do networking. |
Yeah it's been a couple months since I posted here. What's the status on the working group? I would love to voice my opinion on the current set of suggested ideas. |
#74 has landed, and we recently published our first API update using the new mechanism and process. We recently had an in-person meeting about HTTP APIs; see the notes there, especially the slides linked there, for more info. With that said, two things to keep in mind: One is that the next big step in WASI happening soon is that the API will be made modular, so that it's straitghtforward for implementations to chose not to implement features which don't make sense for them. Many implementations won't chose to implement HTTP proxying APIs, for example. The other is that WASI can address multiple levels of abstraction with different APIs. The fact that we're considering an HTTP API now doesn't preclude doing a plain sockets style API as well. And ideally, it should be possible to implement HTTP APIs on top of sockets APIs, so that an implementation could chose to support just sockets, and support the HTTP APIs via a pure wasm module loaded on top. |
HTTP features in a low-level POSIX-like API seems highly out of place - let third-parties implement that stuff on top of the, low-level BSD-like socket syscalls from WASI instead (assuming they are added at some point). An HTTP server or client is really high-level and can be implemented in a million different ways with tons of different goals and opinions - BSD sockets on the other hand are quite standardized and efficient and a much more logical fit for a low level base WASM API like WASI. There are about a million web servers and clients ready to compile for WASI as soon as networking syscalls are added - let them figure out how to bring HTTP to WASM. If you need an HTTP client, wouldn't it makes sense to let the market self-organize and let things like curl or wget come out the victor? I sure would prefer curl-on-WASI, rather than some new HTTP-client from WASI itself. |
Once low level sockets are implemented, then any upper level protocol can work. I can use "fetch" to access external data, but I want sockets to be able to listen. |
We agree that low level BSD-like socket functionality should be part of WASI. The HTTP interfaces we are working on are motivated by two environments (Fastly's Compute@Edge product, and Istio/ATS's proxy-wasm environment https://github.com/WebAssembly/wasi-http-proxy) where low-level socket access is inappropriate or impossible. These interfaces are not intended to replace socket interfaces or displace use of curl/wget in those environments. |
Alright I misunderstood what WASI was about. Apparently it's not just low level. But we still want BSD sockets :) |
As @pchickey said, low level sockets do make sense. I'm not aware of anyone currently driving the process of working out a proposal for a WASI module. If that's something you'd be interested in helping drive, opening an issue in the WASI spec repository might make sense. See the recent issue on WASI-nn as an example. (Though of course something not as fully fleshed out definitely works as a starting point!) We'd be happy to provide help with implementations in Wasmtime, be they experimental to support the standards process, or production-quality to already serve use cases! |
Suggest adding labels "wasi-network-sockets" and "feature-requests". |
@MikeCamel we don't have those, and should be careful about adding too many labels. I added the |
Sounds good, thanks. |
Is there any progress on this front? I was surveying krustlet for usage, but i quickly realized that quite core functionality like networking wasn't implemented all the way back here in Are there any proposals/issues/requests/PRs that I can follow on WASI's side to see progress regarding this? |
We at Kong we are working on full socket implementation for WASI. We included connect, bind, listen, accept, etc. We also added some security features so the host does have some sort of control about what the WASM code can connect to, listen to, and so forth. I think it aligns with everything I am reading on this thread. You can find the proposal here: I would love to hear some feedback on it. |
@3miliano that looks great! A couple of random comments below:
I was sketching a draft proposal mostly focusing on those aspects, though the other POSIX related stuff is similar to yours. |
@3miliano can we maybe see the link to the pull request into WASI proper once it's up? Interesting proposal, I'll be looking out for it |
@ueno On the topic of TLS. Yes, that would be interesting. One thing to consider is that TLS doesn't exactly require system calls, and therefore you can of course compile a TLS library such as WoflSSL, OpenSSL, etc in WASM itself. Having said that, I hear you about the TLS. That might be something to look out for in the future. I'll take a look at your proposal, maybe we can collaborate on a single solution. |
Should this #71 and #73 be moved to https://github.com/webassembly/wasi? |
Pardon me, but are there any updates concerning this topic? |
The draft of the proposal is here: https://github.com/badeend/WASI-Networking |
For who concerns, the draft of the proposal now moved to here: https://github.com/WebAssembly/wasi-sockets |
Thanks for keeping us up to date! |
* Rename `wasi-future` to `waitable`. You can wait on `waitable`s multiple times, which differs from proper futures, which you can only wait on once. * Rename `waitable` to `pollable`. Because the function they're passed to is `poll-oneoff`.
* Rename `wasi-future` to `waitable`. You can wait on `waitable`s multiple times, which differs from proper futures, which you can only wait on once. * Rename `waitable` to `pollable`. Because the function they're passed to is `poll-oneoff`.
WASI now has low-level sockets and higher-level HTTP support. So I think this can be closed now. |
We need a full fledged networking API. This includes functions like
socket()
,connect()
,bind()
,listen()
,accept()
,getsockopt()
,setsockopt()
, etc.The text was updated successfully, but these errors were encountered: