planetscale / planetscale/vtprotobuf
wrong pool unmarshal slize
Open
Nobody has claimed this yet.
question
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
wrong pool unmarshal size.
my proto file:
// protoc --go_out=. --plugin protoc-gen-go="/Users/jie.yang05/go/bin/protoc-gen-go" --go-vtproto_out=. --plugin protoc-gen-go-vtproto="/Users/jie.yang05/go/bin/protoc-gen-go-vtproto" --go-vtproto_opt=features=marshal+unmarshal+size+pool ./lineentry.proto
syntax = "proto3";
package index;
option go_package="./proto";
import "github.com/planetscale/vtprotobuf/vtproto/ext.proto";
message lineEntries {
option (vtproto.mempool) = true; // Enable memory pooling
repeated lineEntry lineEntries = 1;
}
message lineEntry {
uint64 address = 1;
uint32 line = 2;
uint32 file = 3;
}
comand
yangjie05-mac:index jie.yang05$ protoc --go_out=. --plugin protoc-gen-go="/Users/jie.yang05/go/bin/protoc-gen-go" --go-vtproto_out=. --plugin protoc-gen-go-vtproto="/Users/jie.yang05/go/bin/protoc-gen-go-vtproto" -I /Users/jie.yang05/go/pkg/mod/github.com/planetscale/vtprotobuf\@v0.4.0/include -I ./ ./lineentry.proto
generate code:
func (m *LineEntries) ResetVT() {
for _, mm := range m.LineEntries {
mm.ResetVT()
}
m.Reset()
}
func (m *LineEntries) ReturnToVTPool() {
if m != nil {
m.ResetVT()
vtprotoPool_LineEntries.Put(m)
}
}
generate code have wrong ResetVT.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with lineentry.proto and the shown protoc command, then inspect the generated LineEntries ResetVT and ReturnToVTPool methods. Trace the pool reset behavior for the repeated lineEntries field and add coverage for the reported case; done means generated ResetVT handles pooled messages with the expected size and contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100