You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're wrapping up our implementation of wasi-http for Spin, and noticed a few issues, including this one. Given that finish-outgoing-stream takes an option<trailers> and finish-incoming-stream returns the same, both of them need to do I/O, which should happen asynchronously and be fallible like all other I/O in the proposal.
In the case of finish-incoming-stream, we can work around the issue by reading the trailers implicitly as part of the last streams::read call on the body and then keep it around until finish-incoming-stream is called. That's what our implementation currently does, but there are drawbacks:
If there's an error reading the trailers, we have no way to report it except when the app thinks it's still reading the body, which feels wrong.
In the case of finish-outgoing-stream, we can again work around the issue by spawning a task that writes the trailers, but again we have no obvious way of reporting any errors that occur, and the application has no way of knowing when the trailers have actually made it to the network, successfully or otherwise.
Alternatively, we could declare that both calls block, but that would be odd considering everything else is asynchronous, and we're still left with the question of how to report I/O errors.
I realize that this whole issue may end up being irrelevant once we have real streams, but that's a long way away from what I understand.
Thoughts?
The text was updated successfully, but these errors were encountered:
We're wrapping up our implementation of
wasi-http
for Spin, and noticed a few issues, including this one. Given thatfinish-outgoing-stream
takes anoption<trailers>
andfinish-incoming-stream
returns the same, both of them need to do I/O, which should happen asynchronously and be fallible like all other I/O in the proposal.In the case of
finish-incoming-stream
, we can work around the issue by reading the trailers implicitly as part of the laststreams::read
call on the body and then keep it around untilfinish-incoming-stream
is called. That's what our implementation currently does, but there are drawbacks:In the case of
finish-outgoing-stream
, we can again work around the issue by spawning a task that writes the trailers, but again we have no obvious way of reporting any errors that occur, and the application has no way of knowing when the trailers have actually made it to the network, successfully or otherwise.Alternatively, we could declare that both calls block, but that would be odd considering everything else is asynchronous, and we're still left with the question of how to report I/O errors.
I realize that this whole issue may end up being irrelevant once we have real streams, but that's a long way away from what I understand.
Thoughts?
The text was updated successfully, but these errors were encountered: