Skip to content

Connection Idle Timeout silently no-ops unless UseLegacyIdleTimeoutBehavior is flipped — flip/remove the gate at GA, or make the mismatch loud #4581

Closed

Description

@federico-paganini

The problem

Connection Idle Timeout (#4295, 7.1.0-preview2) parses on the connection string but silently changes nothing unless the adopter also flips Switch.Microsoft.Data.SqlClient.UseLegacyIdleTimeoutBehavior to false (default true). We validated this empirically — with the switch at its default, the pool keeps serving connections idle far beyond the configured value; methodology and full results in this #3667 comment.

The XML docs do state the gate, but a connection-string keyword that no-ops silently is a support-noise generator: adopters will set it, observe no change, and file "keyword doesn't work" issues. A configuration setting whose effect depends on a different configuration mechanism (AppContext) is easy to half-adopt — and, per our testing, the failure is invisible: no warning, no error, identical behavior.

Proposal

For 7.1.0 GA, in order of preference:

  1. Flip the gate (or remove it) at GA. The feature pre-empts middleboxes that silently drop idle TCP (managed egresses like Azure Container Apps / App Service NAT drop at ~4 min, no RST) — the failure mode behind many longstanding "intermittent transport error" reports. The documented 300 s default is conservative. The one cost we measured (7.1.0-preview2 and preview3, identical): Min Pool Size retainees are expired at checkout only — nothing at or below the minimum is refreshed in the background — so after an idle gap longer than the timeout the first N callers each pay a cold open, and the floor does not re-warm on its own. Min Pool Size keeps its count guarantee, not its warm guarantee. Neither the keyword docs nor the release note mention this interaction; it belongs in the callout either way. It IS an ecosystem-wide default change and deserves a prominent release-note callout — but GA is exactly the moment such a change is expected.
  2. If the gate must stay, make the mismatch loud instead of silent: a one-time warning event (or at minimum a prominent release-note callout) when Connection Idle Timeout is present in the connection string while the legacy switch still gates it off.

Happy to contribute the release-note text and/or the docs side either way — we already took #3412 (AppContext switch docs), where this switch is one of the undocumented ones.

Activity

  1. github-actions commented on Aug 24, 2026

    @github-actions

    🔍 Triage Summary

    Check Result
    Issue type Feature
    Environment N/A — feature/proposal issue; no environment details required
    Area Area\Connection Pooling
    Duplicates Related: #4295 (Connection Idle Timeout feature), #343 (Pool Idle Timeout original request), #3667 (empirical repro referenced in issue body)
    Regression Not applicable

    Analysis

    This proposal identifies a UX hazard introduced in 7.1.0-preview2: the Connection Idle Timeout connection-string keyword silently no-ops when Switch.Microsoft.Data.SqlClient.UseLegacyIdleTimeoutBehavior is at its default value (true), making the keyword appear to work while having zero effect. The author proposes either flipping/removing the AppContext gate at GA (option 1) or emitting a diagnostic warning when the keyword is set but the gate blocks it (option 2). This is a P2 issue — it doesn't cause data loss or crashes, but it creates a subtle misconfiguration trap that could cause reliability regressions for adopters targeting idle-connection eviction on NAT-heavy managed egresses (Azure Container Apps, App Service, etc.).

    Next Steps

    • Assign to the Copilot coding agent to evaluate the impact of flipping the UseLegacyIdleTimeoutBehavior default to false for GA (option 1): search LocalAppContextSwitches.cs for the switch definition, check SqlConnectionPool / DbConnectionPool for all call sites, and assess whether any existing test relies on the legacy behavior. If the flip is too risky for GA, implement option 2 (a one-time EventSource warning fired when Connection Idle Timeout is parsed from the connection string but the legacy gate is still active).
    • Review the empirical data linked in #3667 comment to validate the 300 s default and eviction behavior before committing to either option.
    • Ensure a prominent release-note entry accompanies whichever fix lands for 7.1.0 GA.

    Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.

    Generated by SqlClient Issue Auto-Triage for issue #4581 · 32.2 AIC · ⌖ 4.79 AIC · ⊞ 8.6K · ◷

  2. cheenamalhotra commented on Sep 1, 2026

    @cheenamalhotra
    Member

    @mdaigle could you please take a look?

  3. mdaigle commented on Sep 3, 2026

    @mdaigle
    Contributor

    Hi @federico-paganini, thanks for the comment, I appreciate that it's a little confusing. I will update the docs and call out the gate in the release notes. I added this gate to avoid unintentional regressions for the existing connection pool in a minor version release. The default will flip in the 8.0 release when the v2 pool is also enabled by default.

  4. moved this from To triage to Done in SqlClient Boardon Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions