Skip to content

Replace internal connection pool state enum with a boolean #4795

Description

@priyankatiwari08

Is your feature request related to a problem? Please describe.

The pool shutdown work in #4302 deferred a follow-up to simplify internal connection pool state tracking. The discussion concluded that the pools need to distinguish running from not running, rather than introduce additional lifecycle states.

The current enum-based representation also encourages checks and log messages that assume "not running" specifically means "shutting down."

Describe the solution you'd like

Replace the internal connection pool state enum with a boolean running flag, consistently across ChannelDbConnectionPool and WaitHandleDbConnectionPool.

  • Update initialization, startup, shutdown, and state checks to use the boolean consistently.
  • Preserve existing concurrency guarantees and shutdown behavior, including idempotency and the rule that a shut-down pool is not resurrected.
  • Update associated comments and diagnostics to describe running/not-running accurately.
  • Add or update tests covering both pool implementations, including synchronous and asynchronous acquisition during shutdown.

This is an internal implementation change; it must not change the public SqlConnection.State API or the System.Data.ConnectionState enum.

Describe alternatives you've considered

Retain an enum and introduce explicit lifecycle states such as Created, Starting, Started, Stopping, and Stopped. This was discussed in #4302, but the follow-up direction was to use a boolean without introducing new states.

Additional context

Source: User Story 45932: Changing ConnectionState from enum to bool.

Related PR: #4302 — Implement pool shutdown for ChannelDbConnectionPool and harden WaitHandleDbConnectionPool shutdown.

Relevant discussions:

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions

    🔍 Triage Summary

    Check Result
    Issue type Feature
    Environment N/A (feature request, internal refactor)
    Area Area\Connection Pooling
    Duplicates None found. Potentially related: #4719, #4720, #4302
    Regression Not indicated

    Analysis

    Proposes replacing the internal pool state enum with a boolean "running" flag in ChannelDbConnectionPool and WaitHandleDbConnectionPool, following the #4302 shutdown work. It is an internal refactor with no public API change, but it touches concurrency-sensitive shutdown paths. Severity: P3.

    Next Steps

    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 #4795 · copilot · auto · 23.7 AIC · ⌖ 11.6 AIC · ⊞ 13.4K · ◷

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

Metadata

Metadata

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions