-
Notifications
You must be signed in to change notification settings - Fork 4.1k
gogoproto: calling .String() can panic #63299
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Description
Describe the problem
For some reason, (*raftpb.Entry).String() panics, see #63298:
"field raftpb.Entry.Term has invalid type: got uint64, want pointer"
This smells a lot like it has something to do with (gogoproto.nullable)=true:
message Entry {
optional uint64 Term = 2 [(gogoproto.nullable) = false]; // must be 64-bit aligned for atomic operations
optional uint64 Index = 3 [(gogoproto.nullable) = false]; // must be 64-bit aligned for atomic operations
optional EntryType Type = 1 [(gogoproto.nullable) = false];
optional bytes Data = 4;
}
The panic is emitted from the golangproto table marshaling code, which is
unexpected to me.
The raftpb package is also using gogoproto, so I don't understand why. It must be some kind of version incompatibility; it doesn't panic from within the upstream repo.
This seems like a time bomb, so we should investigate.
To Reproduce
See the unit test added in #63298.
Expected behavior
Stringers should string :-)
Additional data / screenshots
Environment:
- master at time of writing
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.