MultiSubnetFailover parallel connect fails if one address errors immediately (managed SNI)

已关闭
#4,928 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@cheenamalhotra 已经在做这个了。

开始于 2026年10月27日。

  • #4929 来自 @cheenamalhotra —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

Describe the bug

With MultiSubnetFailover=true, managed SNI (SniTcpHandle.ParallelConnect) connects to all resolved addresses in parallel. If one address fails immediately on Socket.Connect (any error other than WouldBlock, e.g. HostUnreachable, NetworkUnreachable, AddressFamilyNotSupported), the exception escapes the loop:

  • The whole connection fails, even when another address is reachable.
  • Sockets already created are not disposed.

Common case: a host resolves to IPv4 + IPv6, and the client has no IPv6 route (containers, VPNs, some cloud networks).

This matters more once MSF is on by default (#4876, #4927).

To reproduce

Call ParallelConnect with [<unreachable address>, 127.0.0.1] where a listener is on the loopback port. It throws instead of returning the loopback socket.

Expected behavior

Skip addresses that fail immediately, keep trying the rest, and dispose every non-selected socket on all exit paths.

Further technical details

Microsoft.Data.SqlClient: main
.NET: 10.0 (managed SNI; Unix, or Windows with managed networking)

主要语言
C#
星标
1k
派生
352
平均合并
4 天 12 小时
30 天内合并 PR
86

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/SqlClient 的其他 Issue

查看 dotnet/SqlClient 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。