SHUTDOWN_COMPLETE event happening before all received data could be processed #1384
Labels
Area: API
Area: Core
Related to the shared, core protocol logic
Bug: Core
A code bug in the Core MsQuic code
Milestone
I am investigating failing tests in
System.Net.Quic
library that uses msquic. The tests are very basic, there is a peer sending some data to an endpoint (let me call it my app) in a unidirectional stream and then indicating a graceful shutdown. After that, as soon as my app's msquic acks this shutdown,SHUTDOWN_COMPLETE
event appears on both sides. On my app side though, this event doesn't seem to pay attention to pendingRECEIVE
data (the one that got buffered by msquic but is yet to be read by the app). It may be important that the app reads the data asynchronously (i.e. returnsQUIC_STATUS_PENDING
, and then calls toStreamReceiveComplete
andStreamReceiveSetEnabled
when finished)There are two scenarios in which I got
SHUTDOWN_COMPLETE
event in the middle of processing the data.1. When the reads are complete
(peer sends e.g. 10K and I receive in a buffer of the same size)
I sometimes will get
SHUTDOWN_COMPLETE
right away after the lastRECEIVE
-- even before I'm able to callStreamReceiveComplete
, and in this caseStreamReceiveComplete
will fail. Events will go as follows:2. When reads are partial
(peer sends e.g. 10K and I read data in an 1K buffer several times)
In this case, I don't get any errors, but I lose data. E.g. I will read 3K and then I'll get a
SHUTDOWN_COMPLETE
event. After that there is no way to get the rest of data, even though it was already buffered inside msquic.Expected behavior
Is it possible for PEER_SEND_SHUTDOWN/SHUTDOWN_COMPLETE to behave in line with RECEIVE events (so I'll get it after I notify msquic that previous receive is completed)?
cc @nibanks
The text was updated successfully, but these errors were encountered: