-
Notifications
You must be signed in to change notification settings - Fork 1.5k
spanner: panic on native metrics #11080
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
Description
I have found the client built in metrics(#10419, #10998) can panic in some condition.
Client
Spanner
Environment
go version go1.23.2 darwin/arm64
Code and Dependencies
I can't find minimum reproducing code, but I can reproduce it in cloudspannerecosystem/spanner-cli.
Reproducing branch
Only do go get cloud.google.com/go/spanner@v1.71.0
$ go test -v -run TestRequestPriority
=== RUN TestRequestPriority
=== RUN TestRequestPriority/use_default_MEDIUM_priority
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x10316ef04]
goroutine 94 [running]:
cloud.google.com/go/spanner.(*builtinMetricsTracer).toOtelMetricAttrs(0x14000384090, {0x1032c539b, 0xf})
/Users/apstndb/go/pkg/mod/cloud.google.com/go/spanner@v1.71.0/metrics.go:424 +0x3f4
cloud.google.com/go/spanner.recordOperationCompletion(0x14000384090)
/Users/apstndb/go/pkg/mod/cloud.google.com/go/spanner@v1.71.0/metrics.go:490 +0x58
cloud.google.com/go/spanner.(*grpcSpannerClient).BatchCreateSessions(0x1400058a870, {0x1038a1980, 0x14000414d80}, 0x14000470000, {0x1400038a0c0, 0x1, 0x1})
/Users/apstndb/go/pkg/mod/cloud.google.com/go/spanner@v1.71.0/grpc_client.go:134 +0x1c4
cloud.google.com/go/spanner.(*sessionClient).executeBatchCreateSessions(0x14000528160, {0x1038ae1b8, 0x1400058a870}, 0x1, 0x14000584690, 0x140005846c0, {0x10389aed8, 0x14000270200})
/Users/apstndb/go/pkg/mod/cloud.google.com/go/spanner@v1.71.0/sessionclient.go:277 +0x430
created by cloud.google.com/go/spanner.(*sessionClient).batchCreateSessions in goroutine 50
/Users/apstndb/go/pkg/mod/cloud.google.com/go/spanner@v1.71.0/sessionclient.go:243 +0x2f8
exit status 2
FAIL github.com/cloudspannerecosystem/spanner-cli 0.492s
Workaround
Use DisableNativeMetrics: true.
apstndb/spanner-cli-classic#2
Expected behavior
Client built in metrics don't break user code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.