Skip to content

Connect retry count not respected when server times out on prelogin #3527

Closed

Description

@mdaigle

Describe the bug

When a server instance goes down or comes under heavy load, it can begin timing out on prelogin requests. As long as these timeouts take less than the user-configured connection timeout, the driver will keep retrying until the connection timeout is reached. These retries do not respect the user-configured connection retry count.

Relates to #3528

To reproduce

To reliably reproduce, requires a custom server instance where arbitrary delays can be injected.

On the server, inject a delay of 10s on prelogin.

Connect to the server with the following options:
ConnectTimeout = 30
ConnectRetryInterval = 1
ConnectRetryCount = 0

Observe that multiple connection attempts are made.

Expected behavior

Only a single connection attempt is made.

Further technical details

Microsoft.Data.SqlClient version: 5.1, 6.0, 6.1
.NET target: all targets
SQL Server version: any
Operating system: any

Additional context
Add any other context about the problem here.

Activity

  1. added theissue type on Jul 29, 2025
  2. modified the milestones: 6.1.1, 5.1.8 on Jul 29, 2025
  3. self-assigned this
    on Jul 29, 2025
  4. mdaigle commented on Aug 18, 2025

    @mdaigle
    ContributorAuthor

    If we correct the default TNIR setting (as described here: #3528), we may not need to do anything for this issue. The driver will not use the parallel connection strategy and will properly respect the connect timeout and retry count.

  5. moved this from To triage to Backlog in SqlClient Boardon Oct 16, 2025
  6. mdaigle commented on Oct 28, 2025

    @mdaigle
    ContributorAuthor

    Determined that this behavior was due to TNIR. Disabling TNIR gives the expected behavior.

  7. removed this from the 7.0.0-preview3 milestone on Dec 2, 2025
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