cockroachdb / cockroachdb/cockroach

drpc: `grpcutil.IsClosedConnection` uses error msg text to identify closed connections

Open
#160,925 1 comment 0 reactions 0 assignees View on GitHub
A-server-networking branch-master C-bug T-db-server
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.