Streams that never send data should still close cleanly#43
Conversation
Streams that never transmitted data when closing cleanly might still be in the ready state, which will lead to a RESET_STREAM instead of a clean shutdown.
|
Sending a RESET_STREAM is perfectly OK. I'm not sure why this is a problem? |
|
It fabricates an application error code (in this case 0) that was not generated by the application. RFC Section 11.2 also says:
|
|
That just means that, if we are closing streams from under the application, it may cause problems. If the application still closed the stream abruptly, we can still send RESET_STREAM and I would argue that's the correct way to do it because we should not be required to hold on and retransmit any pending data as that was not what the application asked for. It's not clear to me if the code already addresses that. Also, I think what we need to do is go from ready -> send -> data_sent. Is that happening here? See https://www.rfc-editor.org/rfc/rfc9000.html#name-sending-stream-states |
Just for my understanding too, this is causing issues at the application layer I am assuming? |
|
So far I just ran into this while writing a test. |
|
Sorry, I missed this one.
Yes, I agree.
This code path is taken when the state is already I'll check if I can improve the test case to be more explicit about this. |
Yeah, that makes sense to address, thank you @josephnoir |
A stream that never sends remains in the
readystate. When closing without and error, this still results in aRESET_STREAMmessage instead of a clean close (frame with FIN). This PR moves such streams fromreadytosendwhen no error was reported and setscloseWritetofalse(which is important for packet loss paths?).