cockroachdb / cockroachdb/cockroach
drpc: `grpcutil.IsClosedConnection` uses error msg text to identify closed connections
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
`grpcutil.IsClosedConnection` determines whether an error is caused by a closed connection by inspecting the error message text. This is considered an anti-pattern in Go (see the [Go Error Value FAQ](https://go.dev/wiki/ErrorValueFAQ)
). As a result, this utility is fragile and has led to subtle bugs. ([example](https://github.com/cockroachdb/cockroach/pull/160780))
As part of the DRPC migration, we should evaluate alternative approaches that do not rely on error message text.
https://github.com/cockroachdb/cockroach/blob/8f4429dd30dbb676566844b518d0da497679c438/pkg/util/grpcutil/grpc_util.go#L82-L103
Jira issue: CRDB-58621
Contributor guide
Assessment
This issue has not been assessed yet.