Skip to content

Memory leak on ConnectionOpen then ConnectionStart on v2.5.1Β #5329

@StoicSirius

Description

@StoicSirius

Describe the bug

Mentioned in #4362.

Continuous calls to ConnectionOpen, followed by ConnectionStart, and then ConnectionClose in the connection callback causes continuous memory growth. It's not necessary for a server to be listening on the other end. A previous test on 2.4.8 installed via vcpkg caused a similar leak, but with ConnectionStart omitted. The 2.5.1 version compiled with QuicTLS, however, does not seem to have this problem.

A trace run on the following loop on Windows 10 build 19041.450:
trace.zip

for (int i = 0; i < 200; ++i) {
  HQUIC * Connection = new HQUIC(nullptr);

  QUIC_STATUS status = api_table->ConnectionOpen(Registration, ConnectionCallback, Connection, Connection);
  api_table->ConnectionStart(*Connection, Configuration, QUIC_ADDRESS_FAMILY_INET, "127.0.0.1", 8000);
  std::this_thread::sleep_for(std::chrono::milliseconds(100));
}

With the callback:

QUIC_STATUS ConnectionCallback(HQUIC Connection, void * Context, QUIC_CONNECTION_EVENT * Event) {
  switch (Event->Type) {
    case QUIC_CONNECTION_EVENT_SHUTDOWN_COMPLETE:
      api_table->ConnectionClose(Connection);
      delete (HQUIC *)Context;
      break;

    default:
      break;
  }

  return QUIC_STATUS_SUCCESS;
}

Metadata

Metadata

Assignees

Labels

Area: CoreRelated to the shared, core protocol logicTriagedThis item has been triaged by an MsQuic owner

Type

Projects

Status

Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions