golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.8k stars 1.58k forks source link

nil pointer error inside protobuf library. #1588

Open akhil200 opened 10 months ago

akhil200 commented 10 months ago

What version of protobuf and what language are you using? Version: (e.g., v1.1.0, 89a0c16f, etc) image golang 1.19.1

What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good with .proto and .go source code. nil pointer error while process of acknowledging the message.

What did you expect to see? successful ack of messages

What did you see instead? ERROR 2024-01-23T04:42:33.082192511Z [resource.labels.containerName: rawdataconsumerd] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x467c98] goroutine 13271054 [running]: google.golang.org/protobuf/encoding/protowire.AppendString(...) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/encoding/protowire/wire.go:455 google.golang.org/protobuf/internal/impl.appendStringSliceValidateUTF8({0xc034344c00?, 0x7f5e0615ba60?, 0x7e3159?}, {0x7f5e2f0acd28?}, 0xc00056a1a8, {0x0?}) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/codec_gen.go:5167 +0xfa google.golang.org/protobuf/internal/impl.(MessageInfo).marshalAppendPointer(0xc000026b90, {0xc034344c00?, 0x7f5e060524a8?, 0x0?}, {0x7f5e2f0acd28?}, {0x0?}) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/encode.go:139 +0x14f google.golang.org/protobuf/internal/impl.(MessageInfo).marshal(0x0?, {{}, {0xfa7c28, 0xc00c7c8460}, {0xc034344c00, 0x0, 0x5d3}, 0x2}) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/encode.go:107 +0x85 google.golang.org/protobuf/proto.MarshalOptions.marshal({{}, 0x60?, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xfa7c28, 0xc00c7c8460}) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/proto/encode.go:166 +0x27b google.golang.org/protobuf/proto.MarshalOptions.MarshalAppend({{}, 0xe0?, 0xc2?, 0xd8?}, {0x0, 0x0, 0x0}, {0xf97920?, 0xc00c7c8460?}) /go/pkg/mod/google.golang.org/protobuf@v1.30.0/proto/encode.go:125 +0x79 github.com/golang/protobuf/proto.marshalAppend({0x0, 0x0, 0x0}, {0x7f5e08143458?, 0xc00c7c8460?}, 0x18?) /go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:40 +0xa5 github.com/golang/protobuf/proto.Marshal(...) /go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:23 google.golang.org/grpc/encoding/proto.codec.Marshal({}, {0xd8c2e0, 0xc00c7c8460}) /go/pkg/mod/google.golang.org/grpc@v1.55.0/encoding/proto/proto.go:45 +0x4e google.golang.org/grpc.encode({0x7f5e07fbd210?, 0x1602498?}, {0xd8c2e0?, 0xc00c7c8460?}) /go/pkg/mod/google.golang.org/grpc@v1.55.0/rpc_util.go:632 +0x44 google.golang.org/grpc.prepareMsg({0xd8c2e0?, 0xc00c7c8460?}, {0x7f5e07fbd210?, 0x1602498?}, {0x0, 0x0}, {0x0, 0x0}) /go/pkg/mod/google.golang.org/grpc@v1.55.0/stream.go:1753 +0xd2 google.golang.org/grpc.(clientStream).SendMsg(0xc03a6a7e60, {0xd8c2e0?, 0xc00c7c8460}) /go/pkg/mod/google.golang.org/grpc@v1.55.0/stream.go:874 +0xfd google.golang.org/grpc.invoke({0xfa3a50?, 0xc043f2ff80?}, {0xe688fc?, 0x18?}, {0xd8c2e0, 0xc00c7c8460}, {0xd515a0, 0xc040805b60}, 0x0?, {0xc0004… { "textPayload": "panic: runtime error: invalid memory address or nil pointer dereference\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x467c98]\n\ngoroutine 13271054 [running]:\ngoogle.golang.org/protobuf/encoding/protowire.AppendString(...)\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/encoding/protowire/wire.go:455\ngoogle.golang.org/protobuf/internal/impl.appendStringSliceValidateUTF8({0xc034344c00?, 0x7f5e0615ba60?, 0x7e3159?}, {0x7f5e2f0acd28?}, 0xc00056a1a8, {0x0?})\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/codec_gen.go:5167 +0xfa\ngoogle.golang.org/protobuf/internal/impl.(MessageInfo).marshalAppendPointer(0xc000026b90, {0xc034344c00?, 0x7f5e060524a8?, 0x0?}, {0x7f5e2f0acd28?}, {0x0?})\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/encode.go:139 +0x14f\ngoogle.golang.org/protobuf/internal/impl.(MessageInfo).marshal(0x0?, {{}, {0xfa7c28, 0xc00c7c8460}, {0xc034344c00, 0x0, 0x5d3}, 0x2})\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/internal/impl/encode.go:107 +0x85\ngoogle.golang.org/protobuf/proto.MarshalOptions.marshal({{}, 0x60?, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xfa7c28, 0xc00c7c8460})\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/proto/encode.go:166 +0x27b\ngoogle.golang.org/protobuf/proto.MarshalOptions.MarshalAppend({{}, 0xe0?, 0xc2?, 0xd8?}, {0x0, 0x0, 0x0}, {0xf97920?, 0xc00c7c8460?})\n\t/go/pkg/mod/google.golang.org/protobuf@v1.30.0/proto/encode.go:125 +0x79\ngithub.com/golang/protobuf/proto.marshalAppend({0x0, 0x0, 0x0}, {0x7f5e08143458?, 0xc00c7c8460?}, 0x18?)\n\t/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:40 +0xa5\ngithub.com/golang/protobuf/proto.Marshal(...)\n\t/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:23\ngoogle.golang.org/grpc/encoding/proto.codec.Marshal({}, {0xd8c2e0, 0xc00c7c8460})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/encoding/proto/proto.go:45 +0x4e\ngoogle.golang.org/grpc.encode({0x7f5e07fbd210?, 0x1602498?}, {0xd8c2e0?, 0xc00c7c8460?})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/rpc_util.go:632 +0x44\ngoogle.golang.org/grpc.prepareMsg({0xd8c2e0?, 0xc00c7c8460?}, {0x7f5e07fbd210?, 0x1602498?}, {0x0, 0x0}, {0x0, 0x0})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/stream.go:1753 +0xd2\ngoogle.golang.org/grpc.(clientStream).SendMsg(0xc03a6a7e60, {0xd8c2e0?, 0xc00c7c8460})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/stream.go:874 +0xfd\ngoogle.golang.org/grpc.invoke({0xfa3a50?, 0xc043f2ff80?}, {0xe688fc?, 0x18?}, {0xd8c2e0, 0xc00c7c8460}, {0xd515a0, 0xc040805b60}, 0x0?, {0xc00044b400, ...})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/call.go:70 +0xa8\ngoogle.golang.org/grpc.(ClientConn).Invoke(0xc043f2ff80?, {0xfa3a50?, 0xc043f2ff80?}, {0xe688fc?, 0xc040805b30?}, {0xd8c2e0?, 0xc00c7c8460?}, {0xd515a0?, 0xc040805b60?}, {0x0, ...})\n\t/go/pkg/mod/google.golang.org/grpc@v1.55.0/call.go:37 +0x265\ncloud.google.com/go/pubsub/apiv1/pubsubpb.(subscriberClient).Acknowledge(0xc00044b930, {0xfa3a50, 0xc043f2ff80}, 0x15d1ea0?, {0x0, 0x0, 0x0})\n\t/go/pkg/mod/cloud.google.com/go/pubsub@v1.33.0/apiv1/pubsubpb/pubsub.pb.go:6684 +0xce\ncloud.google.com/go/pubsub/apiv1.(subscriberGRPCClient).Acknowledge.func1({0xfa3a50?, 0xc043f2ff80?}, {0xea2458, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0xdf8475800})\n\t/go/pkg/mod/cloud.google.com/go/pubsub@v1.33.0/apiv1/subscriber_client.go:1026 +0x7b\ngithub.com/googleapis/gax-go/v2.invoke({0xfa3a88, 0xc040805b30}, 0xc029263870, {0xea2458, {0x0, 0x0, 0x0}, {0x0, 0x0}, 0xdf8475800}, ...)\n\t/go/pkg/mod/github.com/googleapis/gax-go/v2@v2.11.0/invoke.go:82 +0x138\ngithub.com/googleapis/gax-go/v2.Invoke({0xfa3a88, 0xc040805b30}, 0xc006331860?, {0xc0005c28e0, 0x2, 0x40d4e5?})\n\t/go/pkg/mod/github.com/googleapis/gax-go/v2@v2.11.0/invoke.go:50 +0xaa\ncloud.google.com/go/pubsub/apiv1.(subscriberGRPCClient).Acknowledge(0xc0008aa400, {0xfa3a88, 0xc040805950}, 0xc00c7c8460, {0x0, 0x0, 0x0?})\n\t/go/pkg/mod/cloud.google.com/go/pubsub@v1.33.0/apiv1/subscriber_client.go:1024 +0x297\ncloud.google.com/go/pubsub/apiv1.(*SubscriberClient).Acknowledge(...)\n\t/go/pkg/mod/cloud.google.com/go/pubsub@v1.33.0/apiv1/subscriber_client.go:623\ngithub.paypal.com/QualityInfrastructure-R/testdataserv/internal/platform/pubsub.AckMessages({0xfa3a88?, 0xc00c7fc330?}, 0xe52420?, {0xc0310fc900, 0x7, 0x8}, {0xc000040792, 0x15}, {0xc000040345, 0x19})\n\t/

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment?

lfolger commented 10 months ago

To be able to analyze this issue, could you provide steps to reproduce the issue? From the stacktrace itself it is not immediately clear what the issue is.

yywing commented 2 months ago

What is your go version?

Maybe https://github.com/golang/go/issues/67255

hoeppi-google commented 2 months ago

@akhil200 Do you still have this issue, or can we close it?