-
Notifications
You must be signed in to change notification settings - Fork 276
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
Decide how to handle stream Close then Reset #166
Comments
I would say (2) seems best. |
K. I've gone with (2) in libp2p/go-mplex#50. |
I'm having trouble telling how js-libp2p handles this. |
QUIC does 1. Resetting only resets the write-side of a stream, so it would be nonsensical to close the read side of the stream in that case. |
As far as I can tell, it resets both (calls cancelread and cancelwrite). |
Then we have a pretty bad mismatch with QUIC. And resetting both sides makes a lot of application protocols impossible. |
We do need to reconsider the interfaces but I'm not sure how this makes applications impossible. Also, I'm talking about: https://github.com/libp2p/go-libp2p-quic-transport/blob/7424664a6de48f2cfd2e986b46ac997a6666ce06/stream.go#L14-L18. |
Not in every application protocol is “I am terminating sending on this stream” equivalent to “I want you to terminate sending on this stream as well”.
Yes, this is ugly. The only reason we need this is because we have this mismatch in the stream interfaces. I’d love to get rid of this. |
Let me summarise the semantics as I understand them, for passers-by, and for the sake of putting my thoughts in order:
Following this reasoning, option (3) is coherent with my interpretation of semantics, as well as with the declared behaviour: https://github.com/libp2p/go-stream-muxer/blob/211904436b52b258c78d701e52421532b6394107/muxer.go#L22-L23 |
I think we need something akin to reset that doesn't invalidate pending data written. |
That doesn't cover the case where you stop sending data before you're done writing everything. Think for example when a client cancels a HTTP upload before you uploaded the whole file. Just sending the EOF is wrong, you need an explicit signal that you terminated sending. This however doesn't necessarily mean that you're not interested in the server's response, so the client's decision to stop sending on the stream shouldn't have any influence on the read-side of the stream.
You're not alone with that. When designing the API for quic-go, I decided to not have any |
This doesn't need to be handled by the multiplexer IMO. In the case of HTTP 1.1, there are two ways you delimit the content being transferred, either by specifying the length through In other words: |
Content-Length can be -1 in HTTP, to indicate that the data will continue until the end of the connection / stream, so that doesn't works as a reliable signal that a transfer was canceled. When a client cancels an upload:
I'm not sure if that's compatible with how the
Stream cancelations belong at the transport layer and not at the application layer is because normal and abnormal stream terminations come with different expectation about the reliable delivery of data. Both in TCP as well as in QUIC, after resetting the connection (or the stream, respectively), data sent prior to the reset doesn't need to be retransmitted if packets are lost. The only thing that needs to delivered reliably is the RST (or the RESET_STREAM frame, respectively). Depending on your network conditions, this can be a big performance difference. |
If a user calls
Close()
(close-write) and thenReset()
, what should we do?Currently, we don't appear to do any of these consistently in go. IIRC, JS doesn't even expose
Reset()
.The text was updated successfully, but these errors were encountered: