-
Notifications
You must be signed in to change notification settings - Fork 20
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
What does "flush" mean? #73
Comments
Yes, "flush" here isn't about Imagine a |
I understand how the distinct That being said, I can see one place where
I realize it's all still pixie dust at this moment, but it seems that this is the direction Luke is thinking in: https://docs.google.com/presentation/d/1bWUO1Z9swQ4KSmoeUMTwIFYurasn14xFy4o-G8nE15w/edit#slide=id.g266ec2a0918_0_28 |
The However, it could happen that the OS I can also add, this whole protocol of
That's a different kind of "flush" :-). The current wasi-io flush is about "I want to know if there will be any errors reported for the bytes I just wrote". The |
Alright, that at least clears up the confusion :) So, |
Socket writes can fail with |
Oh sorry, I wasn't trying to imply that sockets can't fail. Given that the socket data+failure pipeline is already fully asynchronous by nature (regardless of non-blocking mode of the fd), I don't see why libc needs to block every send on a Edit: I'm only speaking for internet sockets here. Don't know how e.g. UNIX sockets behave. |
BTW, if the answer is something along the lines of: "without having to know what kind of output-stream it is, consumers should follow the check-write, write & flush recipe", then I'm fine with that too. In that case TCP's output-stream will simply ignore flushes. |
Guest code doesn't know what kind of output-stream it has, even if it created the stream with Wasmtime's tokio-based implementation is subtle enough that I'm not confident enough that I know what it's supposed to do. |
What does "flush" mean? None of the WASI proposals currently define what it means to "flush" one of their output-streams.
wasi-io's documentation on
flush
says:(Aside from the recursive definition 😜),
which buffers, to what extent, and with what goal?
Does this include OS buffers? I.e.
write
? Orwrite
+fsync
? (Or does it require the use ofO_DIRECT
to bypass Linux' internal caching entirely 🤭?)send
? Orsend
withTCP_NODELAY
enabled? If a write has not been flushed, does that mean we actually should've sent it withMSG_MORE
in the first place?Or put differently, why should a consumer of a random
output-stream
of which it doesn't know its origin, callflush
(or one of its cousins)? What guarantee do they have after their data has been flushed? Is it now persistently stored on disk? Has it been sent out on the wire? Has the peer successfully received it?As far as I can see in wasmtime, none of
wasi-filesystem
,wasi-sockets
&wasi-http
use flush for anything other than waiting for a previous write to finish.Apologies for the many question marks :)
The text was updated successfully, but these errors were encountered: