gogo / protobuf

[Deprecated] Protocol Buffers for Go with Gadgets
Other
5.67k stars 808 forks source link

gogo/proto marshalling is failing with latest github.com/golang/protobuf v1.4.0-rc.4 #678

Open adithya66 opened 4 years ago

adithya66 commented 4 years ago

panic: protobuf tag not enough fields in ListDeviceRequest.state:

goroutine 25 [running]: github.com/gogo/protobuf/proto.(*unmarshalInfo).computeUnmarshalInfo(0xc000162000) /Users/adithyas/go/pkg/mod/github.com/gogo/protobuf@v1.3.1/proto/table_unmarshal.go:341 +0x17fb

stevvooe commented 4 years ago

I've seen a similar issue:

panic: protobuf tag not enough fields in FileDescriptorSet.state:
goroutine 1 [running]:
github.com/gogo/protobuf/proto.(*unmarshalInfo).computeUnmarshalInfo(0xc000090820)
        /go/src/github.com/gogo/protobuf/proto/table_unmarshal.go:341 +0x17fb
github.com/gogo/protobuf/proto.(*unmarshalInfo).unmarshal(0xc000090820, 0xc00008a5c0, 0xc000320000, 0x4752, 0x4952, 0x40c338, 0x20)
        /go/src/github.com/gogo/protobuf/proto/table_unmarshal.go:138 +0xe13
github.com/gogo/protobuf/proto.(*InternalMessageInfo).Unmarshal(0xc000077940, 0x7b0780, 0xc00008a5c0, 0xc000320000, 0x4752, 0x4952, 0xc00008a501, 0x0)
        /go/src/github.com/gogo/protobuf/proto/table_unmarshal.go:63 +0x66
github.com/gogo/protobuf/proto.(*Buffer).Unmarshal(0xc00010b440, 0x7b0780, 0xc00008a5c0, 0x0, 0x0)
        /go/src/github.com/gogo/protobuf/proto/decode.go:424 +0x1ec
github.com/gogo/protobuf/proto.Unmarshal(0xc000320000, 0x4752, 0x4952, 0x7b0780, 0xc00008a5c0, 0x0, 0x0)
        /go/src/github.com/gogo/protobuf/proto/decode.go:342 +0x170
main.readDesc(0xc000083300, 0x1d, 0x0, 0x0, 0x0)
        /go/src/github.com/stevvooe/protobuild/descriptors.go:96 +0x9e
main.main()
        /go/src/github.com/stevvooe/protobuild/main.go:218 +0x1819
make: *** [Makefile:143: protos] Error 2
DisposaBoy commented 4 years ago

Try rolling back golang/protobuf: go get github.com/golang/protobuf@v1.3

adithya66 commented 4 years ago

I cannot other modules require at least protobuf v1.4.0-rc.4. for Example: https://github.com/openconfig/ygot/blob/master/go.mod so my go.mod automatically updates with latest versionof protobuf.

FelixSeptem commented 4 years ago

due to https://blog.golang.org/protobuf-apiv2 version part will show some clues, try to upgrade a stable version like v1.4.0

FelixSeptem commented 4 years ago

https://github.com/openconfig/ygot/blob/master/go.mod

look go.mod of google.golang.org/protobuf , you will get answer

joe-elliott commented 3 years ago

We were seeing similar issues. Our error is:

panic: invalid Go type model.TraceID for field jaeger.api_v2.SpanRef.trace_id [recovered]
    panic: invalid Go type model.TraceID for field jaeger.api_v2.SpanRef.trace_id

For us issues were triggering on types with custom marshalling/unmarshalling. We are able to fix the issue by using the experimental encoding.RegisterCodec method. We are currently evaluating whether this is a go forward fix for us.

https://github.com/joe-elliott/jaeger/blob/53a4d9d2b6387021c4b97d4b96171e222f181907/proto-gen/api_v2/init.go

I am unfamiliar with the mechanics that grpc uses to choose a codec, why it worked before or why it stopped working. Perhaps this sheds some light on the problem for those who know more about this issue.

Edit:

We were able to make it quite far using this technique but were ultimately blocked by the following error:

panic: protobuf tag not enough fields in Empty.state:

Details here: https://github.com/jaegertracing/jaeger/pull/2857#issuecomment-791704993