`clientv3.dial` blocks when a non-zero DialTimeout is set
type/bugpriority/important-soonrelease/v3.7
### Bug report criteria
- [ ] This bug report is not security related, security issues should be disclosed privately via security@etcd.io.
- [ ] This is not a support request or question, support requests or questions should be raised in the etcd [discussion forums](https://github.com/etcd-io/etcd/discussions).
- [ ] You have read the etcd [bug reporting guidelines](https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/reporting_bugs.md).
- [ ] Existing open issues along with etcd [frequently asked questions](https://etcd.io/docs/latest/faq) have been checked and this is not a duplicate.
### What happened?
Previously in etcd 3.6 and 3.5, the `clientv3.dial` only blocks when `grpc.WithBlock` option is set. Now in 3.7, as long as a non-zero DialTimeout is set, then it's blocked. It changes the behaviour.
When one of the three member is down, etcd v3.7 has different behaviour with v3.6.
**etcd v3.6.9**
```
$ ~/software/etcd-v3.6.9-darwin-arm64/etcdctl endpoint status -w table --cluster
{"level":"warn","ts":"2026-05-28T10:31:55.984953+0100","logger":"etcd-client","caller":"v3@v3.6.9/retry_interceptor.go:68","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0x140002fe960/127.0.0.1:32379","peer":"Peer{Addr: <nil>, LocalAddr: <nil>, AuthInfo: <nil>}","method":"/etcdserverpb.Maintenance/Status","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest balancer error: connection error: desc = \"transport: Error while dialing: dial tcp 127.0.0.1:32379: connect: connection refused\""}
Failed to get the status of endpoint http://127.0.0.1:32379 (context deadline exceeded)
+------------------------+------------------+---------+-----------------+---------+--------+-----------------------+-------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
| ENDPOINT | ID | VERSION | STORAGE VERSION | DB SIZE | IN USE | PERCENTAGE NOT IN USE | QUOTA | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | DOWNGRADE TARGET VERSION | DOWNGRADE ENABLED |
+------------------------+------------------+---------+-----------------+---------+--------+-----------------------+-------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
| http://127.0.0.1:2379 | 8211f1d0f64f3269 | 3.5.23 | | 98 kB | 98 kB | 0% | 0 B | true | false | 2 | 22 | 22 | | | false |
| http://127.0.0.1:22379 | 91bc3c398fb3c146 | 3.5.23 | | 98 kB | 98 kB | 0% | 0 B | false | false | 2 | 22 | 22 | | | false |
+------------------------+------------------+---------+-----------------+---------+--------+-----------------------+-------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
```
**etcd v3.7 (main for now)**
```
$ ./etcdctl endpoint status -w table --cluster
Error: etcdclient: failed to connect to the etcd server: latest balancer error: connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:32379: connect: connection refused": context deadline exceeded
```
This is a regression caused by https://github.com/etcd-io/etcd/pull/21282
Also per grpc's [anti-patterns](https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md), We don't need to check that a ClientConn is "ready" before starting your RPCs, instead we only rely on errors from RPCs.
see more details in https://github.com/etcd-io/etcd/pull/21282#discussion_r3316763876
### What did you expect to happen?
.
### How can we reproduce it (as minimally and precisely as possible)?
.
### Anything else we need to know?
_No response_
### Etcd version (please run commands below)
<details>
```console
$ etcd --version
# paste output here
$ etcdctl version
# paste output here
```
</details>
### Etcd configuration (command line flags or environment variables)
<details>
# paste your configuration here
</details>
### Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)
<details>
```console
$ etcdctl member list -w table
# paste output here
$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here
```
</details>
### Relevant log output
```Shell
```
14 条评论