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

panic: protobuf tag not enough fields in Message.state #1015

Open
dennis-tra opened this issue Feb 3, 2025 · 2 comments
Open

panic: protobuf tag not enough fields in Message.state #1015

dennis-tra opened this issue Feb 3, 2025 · 2 comments
Labels
need/author-input Needs input from the original author

Comments

@dennis-tra
Copy link
Contributor

dennis-tra commented Feb 3, 2025

I updated Nebula dependencies last week and decoding protobuf messages from other peers panic:

caught panic: protobuf tag not enough fields in Message.state: 
goroutine 170 [running]:
runtime/debug.Stack()
        /Users/.../go/src/runtime/debug/stack.go:26 +0x64
github.com/libp2p/go-msgio/protoio.(*uvarintReader).ReadMsg.func1()
        /Users/.../.cache/go/pkg/mod/github.com/libp2p/go-msgio@v0.3.0/protoio/uvarint_reader.go:65 +0x40
panic({0x10673b400?, 0x14001364dd0?})
        /Users/.../go/src/runtime/panic.go:785 +0x124
github.com/gogo/protobuf/proto.(*unmarshalInfo).computeUnmarshalInfo(0x140004c1220)
        /Users/.../.cache/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/table_unmarshal.go:341 +0xfa0
github.com/gogo/protobuf/proto.(*unmarshalInfo).unmarshal(0x140004c1220, {0x106a7c160?}, {0x140012c4000, 0xc49, 0xc49})
        /Users/.../.cache/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/table_unmarshal.go:138 +0x4c
github.com/gogo/protobuf/proto.(*InternalMessageInfo).Unmarshal(0x107b105f0?, {0x106b63ca0, 0x1400071e600}, {0x140012c4000?, 0xc49?, 0xc49?})
        /Users/.../.cache/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/table_unmarshal.go:63 +0xc4
github.com/gogo/protobuf/proto.(*Buffer).Unmarshal(0x14001133e90, {0x106b63ca0, 0x1400071e600})
        /Users/.../.cache/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/decode.go:424 +0x174
github.com/gogo/protobuf/proto.Unmarshal({0x140012c4000, 0xc49, 0xc49}, {0x106b63ca0, 0x1400071e600})
        /Users/.../.cache/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/proto/decode.go:342 +0x10c
github.com/libp2p/go-msgio/protoio.(*uvarintReader).ReadMsg(0x14001abe240, {0x106b63ca0, 0x1400071e600})
        /Users/.../.cache/go/pkg/mod/github.com/libp2p/go-msgio@v0.3.0/protoio/uvarint_reader.go:85 +0x1a4
github.com/dennis-tra/nebula-crawler/libp2p.ctxReadMsg.func1({0x106b60208?, 0x14001abe240?})
        /Users/.../nebula/libp2p/rpc.go:54 +0x68
created by github.com/dennis-tra/nebula-crawler/libp2p.ctxReadMsg in goroutine 1817
        /Users/.../nebula/libp2p/rpc.go:52 +0xec

Downgrading to github.com/libp2p/go-libp2p-kad-dht to v0.28.2 and as a consequence also github.com/libp2p/go-libp2p-record to v0.2.0 (v0.3.0 didn't work) solved the problem. Here's the roll-back commit.

I presume it's related to the recent protobuf update: #975

It panics when I do the following:

import (
	"github.com/libp2p/go-msgio/protoio"
	pb "github.com/libp2p/go-libp2p-kad-dht/pb"
)

var r protoio.ReadCloser
var mes *pb.Message

r.ReadMsg(mes) // <--- panics here

Does the change require me to decode messages differently?

dennis-tra added a commit to dennis-tra/nebula that referenced this issue Feb 3, 2025
@lidel lidel added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Feb 3, 2025
@MarcoPolo
Copy link
Contributor

I've not yet looked closely at this, but at a glance I believe it may be a local issue where Nebula is using the go-msgio/protoio package intended for use with gogo protobuf types for a type that is not gogo protobuf (instead it is now the Google protobuf type).

@guillaumemichel
Copy link
Contributor

The fix on Nebula should be dennis-tra/nebula#88.

@dennis-tra you can provide an update here after trying the fix.

@guillaumemichel guillaumemichel added need/author-input Needs input from the original author and removed kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

No branches or pull requests

4 participants