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

fix(logging): Propagate better errors and prevent infinite retry with invalid UTF-8 chars #7509

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

tomo241
Copy link
Contributor

@tomo241 tomo241 commented Mar 3, 2023

This is to address #3629 .

Invalid UTF-8 characters currently cause deadline exceeded errors after repeated retries [2] against an Internal error which happen when marshaling a message [1] . This makes application code stuck and eventually discard logs.

This change applies the same fix as #5728 to the logging library.

The reproduction steps are described at:
#3629 (comment)

[1]

unicode/utf8.ValidString (/usr/lib/go-1.19/src/unicode/utf8/utf8.go:556)
google.golang.org/protobuf/internal/impl.appendStringValidateUTF8 (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/codec_gen.go:4959)
google.golang.org/protobuf/internal/impl.(*MessageInfo).initOneofFieldCoders.func4 (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/codec_field.go:96)
google.golang.org/protobuf/internal/impl.(*MessageInfo).marshalAppendPointer (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/encode.go:139)
google.golang.org/protobuf/internal/impl.appendMessageSliceInfo (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/codec_field.go:485)
google.golang.org/protobuf/internal/impl.(*MessageInfo).marshalAppendPointer (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/encode.go:139)
google.golang.org/protobuf/internal/impl.(*MessageInfo).marshal (~/go/pkg/mod/google.golang.org/[email protected]/internal/impl/encode.go:107)
google.golang.org/protobuf/internal/impl.(*MessageInfo).marshal-fm (:1)
google.golang.org/protobuf/proto.MarshalOptions.marshal (~/go/pkg/mod/google.golang.org/[email protected]/proto/encode.go:166)
google.golang.org/protobuf/proto.MarshalOptions.MarshalAppend (~/go/pkg/mod/google.golang.org/[email protected]/proto/encode.go:125)
github.com/golang/protobuf/proto.marshalAppend (~/go/pkg/mod/github.com/golang/[email protected]/proto/wire.go:40)
github.com/golang/protobuf/proto.Marshal (~/go/pkg/mod/github.com/golang/[email protected]/proto/wire.go:23)
google.golang.org/grpc/encoding/proto.codec.Marshal (~/go/pkg/mod/google.golang.org/[email protected]/encoding/proto/proto.go:45)
google.golang.org/grpc/encoding/proto.(*codec).Marshal (:1)
google.golang.org/grpc.encode (~/go/pkg/mod/google.golang.org/[email protected]/rpc_util.go:594)
google.golang.org/grpc.prepareMsg (~/go/pkg/mod/google.golang.org/[email protected]/stream.go:1692)
google.golang.org/grpc.(*clientStream).SendMsg (~/go/pkg/mod/google.golang.org/[email protected]/stream.go:830)
google.golang.org/grpc.invoke (~/go/pkg/mod/google.golang.org/[email protected]/call.go:70)
main.ClientInterceptor.func1 (~/dev/myrepo/experiments/logging/sample-w-interceptor/main.go:82)
google.golang.org/grpc.(*ClientConn).Invoke (~/go/pkg/mod/google.golang.org/[email protected]/call.go:35)
google.golang.org/genproto/googleapis/logging/v2.(*loggingServiceV2Client).WriteLogEntries (~/go/pkg/mod/google.golang.org/[email protected]/googleapis/logging/v2/logging.pb.go:1675)
cloud.google.com/go/logging/apiv2.(*gRPCClient).WriteLogEntries.func1 (~/go/pkg/mod/cloud.google.com/go/[email protected]/apiv2/logging_client.go:348)
github.com/googleapis/gax-go/v2.invoke (~/go/pkg/mod/github.com/googleapis/gax-go/[email protected]/invoke.go:72)
github.com/googleapis/gax-go/v2.Invoke (~/go/pkg/mod/github.com/googleapis/gax-go/[email protected]/invoke.go:50)
cloud.google.com/go/logging/apiv2.(*gRPCClient).WriteLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/apiv2/logging_client.go:346)
cloud.google.com/go/logging/apiv2.(*Client).WriteLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/apiv2/logging_client.go:210)
cloud.google.com/go/logging.(*Logger).writeLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/logging.go:708)
cloud.google.com/go/logging.(*Client).Logger.func2 (~/go/pkg/mod/cloud.google.com/go/[email protected]/logging.go:279)

[2]

github.com/googleapis/gax-go/v2.(*boRetryer).Retry (~/go/pkg/mod/github.com/googleapis/gax-go/[email protected]/call_option.go:118)
github.com/googleapis/gax-go/v2.invoke (~/go/pkg/mod/github.com/googleapis/gax-go/[email protected]/invoke.go:98)
github.com/googleapis/gax-go/v2.Invoke (~/go/pkg/mod/github.com/googleapis/gax-go/[email protected]/invoke.go:50)
cloud.google.com/go/logging/apiv2.(*gRPCClient).WriteLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/apiv2/logging_client.go:346)
cloud.google.com/go/logging/apiv2.(*Client).WriteLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/apiv2/logging_client.go:210)
cloud.google.com/go/logging.(*Logger).writeLogEntries (~/go/pkg/mod/cloud.google.com/go/[email protected]/logging.go:708)
cloud.google.com/go/logging.(*Client).Logger.func2 (~/go/pkg/mod/cloud.google.com/go/[email protected]/logging.go:279)

@tomo241 tomo241 requested review from a team as code owners March 3, 2023 11:03
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: logging Issues related to the Cloud Logging API. labels Mar 3, 2023
@daniel-sanche daniel-sanche enabled auto-merge (squash) March 8, 2023 00:34
@meredithslota meredithslota added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 28, 2023
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 28, 2023
@daniel-sanche daniel-sanche merged commit fea5b79 into googleapis:main Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants