-
Notifications
You must be signed in to change notification settings - Fork 838
Description
I don't know whether this problem I am seeing is a bug in quiche or a problem in the way the API is being used. I have noticed this with using curl
as the client and h2o
as the server. Intermittently, curl is hanging at the end of a download, i.e. the entire response body is transferred but curl is not terminating. I have narrowed this down to the following condition:
- the client is receiving data from the socket and handling this properly as far as I can tell, i.e.
recv
,quiche_conn_recv
,quiche_h3_conn_poll
&quiche_h3_recv_body
- at some point the entire body is being transferred and handled by the client. Even though the entire body has been transferred, the STREAM is not being FINinshed by the server yet
- when the final 0-length STREAM frame with the FIN bit sent, the client (in this case curl), goes through
recv
,quiche_conn_recv
&quiche_h3_conn_poll
again. However, the poll function is not raising aQUICHE_H3_EVENT_FINISHED
but is returningQUICHE_ERR_DONE
. As no more data is being sent by the server,quiche_conn_recv
is not being called anymore, effectively leading to a deadlock. - in
h3::poll
, the stream is added to the list of finished stream, though it is not until the next invocation ofh3::poll
that the stream is being reported finished to the API consumer
I have tried to express this behaviour into a test case, though, as I am not familiar with neither quiche nor rust in general, I might have missed something. If I did, please let me know. If necessary, I can provide a PCAP of the problem (enabling quiche debugging leads to the error disappearing as curl is then taking long enough to process everything for the final FIN to arrive in time to be handled in quiche_h3_recv_body
).
You can find the test here: paneu/quiche@18755024305839aa2d9ee13169c740458c5252e9. On master, this test is failing. I have tried to implement a fix that is not breaking any other test case: paneu/quiche@5dc3153d78e4dd6d14110ccfee9be25b35ce754a
As I said, I am not sure whether this is a bug in quiche or whether the API is supposed to be used in a different way.