Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth/oauth2adapt: fatal error: concurrent map writes #11161

Closed
bhshkh opened this issue Nov 20, 2024 · 2 comments · Fixed by #11164
Closed

auth/oauth2adapt: fatal error: concurrent map writes #11161

bhshkh opened this issue Nov 20, 2024 · 2 comments · Fixed by #11164
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@bhshkh
Copy link
Contributor

bhshkh commented Nov 20, 2024

Client

auth/oauth2adapt

Environment

$ go version
go version go1.21.13 linux/amd64

Code and Dependencies

auth/oauth2adapt 0.2.5

Expected behavior

Token call succeeds

Actual behavior

Seeing fatal error: concurrent map writes

fatal error: concurrent map writes

goroutine 235 [running]:
cloud.google.com/go/auth/oauth2adapt.(*tokenSourceAdapter).Token(0x416025?)
	/******/go/pkg/mod/cloud.google.com/go/auth/oauth2adapt@v0.2.5/oauth2adapt.go:107 +0x1a7
google.golang.org/api/transport/grpc.dryRunAsync.Token({{0x13b3b60, 0xc0002aa430}, {0x13b79a0, 0xc00064ee40}, 0xc0003ac360})
	/******/google-api-go-client/transport/grpc/dial.go:290 +0x37
google.golang.org/grpc/credentials/oauth.TokenSource.GetRequestMetadata({{0x13b3ae0?, 0xc00064ee70?}}, {0x13d0118, 0xc0ebe8c750}, {0x0?, 0xc001938130?, 0x410485?})
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/credentials/oauth/oauth.go:42 +0x38
google.golang.org/api/transport/grpc.grpcTokenSource.GetRequestMetadata({{{0x13b3ae0, 0xc00064ee70}}, {0x0, 0x0}, {0x0, 0x0}}, {0x13d0118?, 0xc0ebe8c750?}, {0xc000792590, 0x1, ...})
	/******/google-api-go-client/transport/grpc/dial.go:423 +0x76
google.golang.org/grpc/internal/transport.(*http2Client).getTrAuthData(0xc000034480, {0x13d0118, 0xc0ebe8c750}, {0xc00005a780, 0x3b})
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/internal/transport/http2_client.go:662 +0x14e
google.golang.org/grpc/internal/transport.(*http2Client).createHeaderFields(0xc000034480, {0x13d0118, 0xc0ebe8c720}, 0xc001938b08)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/internal/transport/http2_client.go:544 +0x125
google.golang.org/grpc/internal/transport.(*http2Client).NewStream(0xc000034480, {0x13d0118, 0xc0ebe8c690}, 0xc0005fe180)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/internal/transport/http2_client.go:753 +0x185
google.golang.org/grpc.(*csAttempt).newStream(0xc0008ac1a0)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:504 +0xa7
google.golang.org/grpc.newClientStreamWithParams.func2(0xc0008ac1a0)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:354 +0x34
google.golang.org/grpc.(*clientStream).withRetry(0xc00081a000, 0xc000792490, 0xc001938e88)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:789 +0x13a
google.golang.org/grpc.newClientStreamWithParams({0x13d0118, 0xc0ebe8c3c0}, 0x1e09400, 0xc000641000, {0x1279a65, 0x25}, {0x0, 0x0, 0x0, 0x0, ...}, ...)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:363 +0xc05
google.golang.org/grpc.newClientStream.func3({0x13d0118?, 0xc0ebe8c3c0?}, 0xc0ebe8c3c0?)
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:220 +0x8a
google.golang.org/grpc.newClientStream({0x13d0118, 0xc0ebe8c3c0}, 0x1e09400, 0xc000641000, {0x1279a65, 0x25}, {0xc0000b34a0, 0x2, 0x41902b?})
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:255 +0x7a3
cloud.google.com/go/bigtable/internal/option.streamInterceptor({0x13d0150, 0xc000804140}, 0x7fec18812d28?, 0x10?, {0x1279a65, 0x25}, 0x12bb5a0, {0xc0000b34a0, 0x2, 0x2})
	/******/google-cloud-go/bigtable/internal/option/option.go:70 +0xb6
google.golang.org/grpc.(*ClientConn).NewStream(0xc000792360?, {0x13d0150?, 0xc000804140?}, 0x1082b60?, {0x1279a65?, 0x7febc7811108?}, {0x0?, 0x10?, 0xc000680000?})
	/******/go/pkg/mod/google.golang.org/grpc@v1.67.1/stream.go:168 +0x183
google.golang.org/api/transport/grpc.(*roundRobinConnPool).NewStream(0xc001939228?, {0x13d0150?, 0xc000804140?}, 0x1082b60?, {0x1279a65?, 0xc001939268?}, {0x0?, 0xc000804140?, 0x13d0118?})
	/******/google-api-go-client/transport/grpc/pool.go:64 +0x58
cloud.google.com/go/bigtable/apiv2/bigtablepb.(*bigtableClient).ReadRows(0x13d0118?, {0x13d0150?, 0xc000804140?}, 0x3?, {0x0?, 0xc000817050?, 0x40e49a?})
	/******/google-cloud-go/bigtable/apiv2/bigtablepb/bigtable.pb.go:4026 +0x67
cloud.google.com/go/bigtable.(*Table).readRows.func1({0x13d0118, 0xc0ebe8c2a0}, 0xc000094478, 0xc000094480, {0x12bab28, {0x0, 0x0, 0x0}, {0x0, 0x0}, ...})
	/******/google-cloud-go/bigtable/bigtable.go:420 +0x4fd
cloud.google.com/go/bigtable.gaxInvokeWithRecorder.func2({0x13d0118, 0xc0ebe8c2a0}, {0x12bab28, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0x0})
	/******/google-cloud-go/bigtable/bigtable.go:1626 +0x17d
github.com/googleapis/gax-go/v2.invoke({0x13d0118, 0xc0ebe8c2a0}, 0xc0019398c0, {0x12bab28, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0x0}, ...)
	/******/go/pkg/mod/github.com/googleapis/gax-go/v2@v2.14.0/invoke.go:82 +0x143
github.com/googleapis/gax-go/v2.Invoke({0x13d0118, 0xc0ebe8c2a0}, 0x1e507e0?, {0x1e1b9e0, 0x1, 0x7e2d64?})
	/******/go/pkg/mod/github.com/googleapis/gax-go/v2@v2.14.0/invoke.go:50 +0xd9
cloud.google.com/go/bigtable.gaxInvokeWithRecorder({0x13d0118, 0xc0ebe8c2a0}, 0xc001939cc8, {0x1258292, 0x8}, 0xc001939988, {0x1e1b9e0, 0x1, 0x1})
	/******/google-cloud-go/bigtable/bigtable.go:1648 +0x1e7
cloud.google.com/go/bigtable.(*Table).readRows(0xc0004df260, {0x13d0118, 0xc0ebe8c2a0}, {0x13d02d8, 0xc0c0f66078}, 0xc001939ea8, 0xc0005a0a80?, {0xc00050c220, 0x2, 0x2})
	/******/google-cloud-go/bigtable/bigtable.go:393 +0x1a5
cloud.google.com/go/bigtable.(*Table).ReadRows(0xc0004df260, {0x13d00e0?, 0x1e507e0?}, {0x13d02d8, 0xc0c0f66078}, 0x10?, {0xc00050c220, 0x2, 0x2})
	/******/google-cloud-go/bigtable/bigtable.go:384 +0x230
cloud.google.com/go/bigtable.(*Table).ReadRow(0x108fec0?, {0x13d00e0, 0x1e507e0}, {0xc0756a0060, 0xc}, {0xc001939f38, 0x1, 0x126d17b?})
	/******/google-cloud-go/bigtable/bigtable.go:517 +0x1b8
main.readRowsOneByOne()
	/******/bigtable-client/client.go:109 +0x18f
main.profileThis.func1(0xc0002ecfb8?)
	/******/bigtable-client/client.go:124 +0x45
created by main.profileThis in goroutine 1
	/******/bigtable-client/client.go:122 +0x30
@bhshkh bhshkh added the triage me I really want to be triaged. label Nov 20, 2024
@codyoss
Copy link
Member

codyoss commented Nov 20, 2024

@quartzmo I think we need to make a copy of the map instead of making a pointer alias.

@codyoss codyoss added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed triage me I really want to be triaged. labels Nov 20, 2024
quartzmo added a commit to quartzmo/google-cloud-go that referenced this issue Nov 21, 2024
@quartzmo
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants