diff --git a/src/core/connection.c b/src/core/connection.c index 490d742d46..bdb505593b 100644 --- a/src/core/connection.c +++ b/src/core/connection.c @@ -692,11 +692,14 @@ QuicConnIndicateEvent( // MsQuic shouldn't indicate reentrancy to the app when at all possible. // The general exception to this rule is when the connection is being // closed because the API MUST block until all work is completed, so we - // have to execute the event callbacks inline. + // have to execute the event callbacks inline. Custom executions always + // have InlineApiExecution set, which makes this reentrancy check + // unreliable, so it is skipped for custom executions. // CXPLAT_DBG_ASSERT( !Connection->State.InlineApiExecution || - Connection->State.HandleClosed); + Connection->State.HandleClosed || + MsQuicLib.CustomExecutions); Status = Connection->ClientCallbackHandler( (HQUIC)Connection, diff --git a/src/core/stream.c b/src/core/stream.c index 350dcb557e..ec426b406c 100644 --- a/src/core/stream.c +++ b/src/core/stream.c @@ -470,13 +470,16 @@ QuicStreamIndicateEvent( // or stream is being closed because the API MUST block until all work // is completed, so we have to execute the event callbacks inline. There // is also one additional exception for start complete when StreamStart - // is called synchronously on an MsQuic thread. + // is called synchronously on an MsQuic thread. Custom executions + // always have InlineApiExecution set, which makes this reentrancy + // check unreliable, so it is skipped for custom executions. // CXPLAT_DBG_ASSERT( !Stream->Connection->State.InlineApiExecution || Stream->Connection->State.HandleClosed || Stream->Flags.HandleClosed || - Event->Type == QUIC_STREAM_EVENT_START_COMPLETE); + Event->Type == QUIC_STREAM_EVENT_START_COMPLETE || + MsQuicLib.CustomExecutions); Status = Stream->ClientCallbackHandler( (HQUIC)Stream,