Skip to content

RaceCond: MsQuicStreamOpen and MsQuicConnectionShutdown cause stream leaks #4311

Open
@qzhuyan

Description

@qzhuyan

Describe the bug

Stream could be opened successfully with MsQuicStreamOpen after MsQuicConnectionShutdown is called.

MsQuicConnectionShutdown is async task,

QuicConnQueueHighestPriorityOper(Connection, Oper);

MsQuicStreamOpen is sync call, but there is no synchronization in MsQuicStreamOpen when it checks the states of connection

if (ClosedLocally || Connection->State.ClosedRemotely) {

It could cause stream leaks when the opened stream is not removed here (when processing ):

QuicStreamSetShutdown(&Connection->Streams);

Our application do refcounting for conn handle, that it only calls CONNECTION_CLOSE when all the stream handles belong to the conn are closed.

trouble connection: 0xffff42428100
trouble stream: 0xffff5388e880

Affected OS

  • Windows
  • Linux
  • macOS
  • Other (specify below)

Additional OS information

ubuntu22.04 arm64

MsQuic version

v2.3

Steps taken to reproduce bug

  1. Client establish connection to Server.
  2. Client shutdown the connection.
  3. Client Open the stream on the connection.

Expected behavior

For step 3, it should either

a) fail to open the stream
b) open success but get a "Stream_SHUTDOWN_COMPLETE" event.

Actual outcome

Open success but NO "Stream_SHUTDOWN_COMPLETE" event, completely quiet on callback.

Additional details

quicer_conn_and_strm.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIArea: CoreRelated to the shared, core protocol logicexternalProposed by non-MSFT

    Type

    Projects

    Status

    Planned

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions