msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Explicitly document API ordering constraints

Open pongba opened this issue 2 years ago • 0 comments

Describe the feature you'd like supported

I encountered a case where MsQuicStreamClose is stuck forever at the following line:

https://github.com/microsoft/msquic/blob/main/src/core/api.c#L783

I hooked debugger into the program and was unable to find another thread stuck in StreamCallback or ConnectionCallback (which, if happens, could explain the stuck StreamClose), so my suspicion is that it's because the connection was already closed, and therefore when Line 779 queued operation to connection, it can never be picked up to be executed, leaving CompletionEvent never to be signaled.

But since the line 745 does QUIC_CONN_VERIFY(Connection, !Connection->State.HandleClosed); verify whether the parent connection is closed or not before queueing operation to it. How can the connection be closed when line 779 runs?

Because my program handles StreamClose on a separate thread, so the StreamClose can happen asynchronously to (e.g. later than) the connection closure.

In additional, are there other API ordering constraints?

Proposed solution

Improve documentation of all APIs that has ordering constraints.

Additional context

No response

pongba avatar May 16 '23 23:05 pongba