Skip to content

[SignalR] Fix CTS disposal - #69158

Open
BrennanConroy wants to merge 1 commit into
release/11.0from
brecon/cts
Open

[SignalR] Fix CTS disposal#69158
BrennanConroy wants to merge 1 commit into
release/11.0from
brecon/cts

Conversation

@BrennanConroy

@BrennanConroy BrennanConroy commented Sep 8, 2026

Copy link
Copy Markdown
Member

[SignalR] Fix CTS disposal- #69158

Description

When we added cancellation support for non-streaming methods, we didn't dispose the CTS in error cases.

Customer Impact

Fixes a server reliability issue.

Regression?

  • Yes
  • No

Regressed in 11.0-p6

Risk

  • High
  • Medium
  • Low

Simple change, just missed an error case

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

Copilot AI lite review requested due to automatic review settings September 8, 2026 23:31
@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The change is small, localized, and fixes a concrete CTS disposal leak without altering the normal streaming or cleanup flow.

Review tier: Lite
Findings: None

What changed in this PR

Fixes a CancellationTokenSource lifetime leak in SignalR’s DefaultHubDispatcher streaming invocation path by ensuring the CTS is disposed when an invocation ID collision prevents it from being registered.

Changes:

  • Dispose streamCts when ActiveRequestCancellationSources.TryAdd(invocationId, streamCts) fails due to an invocation ID already being in use.
  • Minor file-end formatting cleanup.
File Description
src/​SignalR/​server/​Core/​src/​Internal/​DefaultHubDispatcher.cs Ensures CTS is disposed on invocation ID collision in StreamAsync to avoid leaking linked CTS instances.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@Youssef1313 Youssef1313 added the Servicing-consider Shiproom approval is required for the issue label Sep 9, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

Comment thread src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs
@artl93
artl93 self-requested a review September 9, 2026 06:36

@artl93 artl93 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispose. Regression. Approved.

@artl93 artl93 added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Sep 9, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @BrennanConroy. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants