apache / dubbo-go

Go Implementation For Apache Dubbo .
https://dubbo.apache.org/
Apache License 2.0
4.71k stars 925 forks source link

使用uint传参报错cat not get arg 0x8 type #1319

Closed tang05709 closed 3 years ago

tang05709 commented 3 years ago

service: type Category struct { Id uint
Name string ParentId uint SeoTitle string SeoKeywords string SeoDescription string Sort uint Children []Category } func (c CategoryProvider) GetCategory(id uint) (*Category, error) { res, err := service.NewCategoryService().FindById(id) if err != nil { return nil, err } fmt.Println(res.Name) return &Category{ Id: res.Id, Name: res.Name, ParentId: res.ParentId, SeoTitle: res.SeoTitle, SeoDescription: res.SeoDescription, Sort: res.Sort, Children: nil, }, nil }

client: type Category struct { Id uint
Name string ParentId uint SeoTitle string SeoKeywords string SeoDescription string Sort uint Children []*Category }

type CategoryProvider struct { GetCategory func(id uint, rsp *Category) error }

调用: category := &consumer.Category{} err := consumer.CategoryProvd.GetCategory(8, category)

What happened: client 返回: 2021-07-15T10:10:26.622+0800 DEBUG dubbo/dubbo_invoker.go:164 result.Err: PackRequest(args:[8]): cat not get arg 0x8 type, result.Rest: 2021-07-15T10:10:26.622+0800 WARN proxy/proxy.go:214 result err: cat not get arg 0x8 type dubbo.apache.org/dubbo-go/v3/common/proxy.DefaultProxyImplementFunc.func1.1 /home/donald/work/gopro/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.0.0-rc2/common/proxy/proxy.go:214 main.main /home/donald/work/gopro/src/besass/article_client/app/main.go:28

传入int64能返回预期的结果: 2021-07-15T10:25:45.060+0800 DEBUG dubbo/dubbo_invoker.go:164 result.Err: , result.Rest: &{8 testname8 0 testtitle8 testdescription8 2}

并且当我把ID和ParentId修改为int64,Sort仍然用uint,也会获取不到数据,返回 panic: maybe the client read timeout or fail to decode tcp stream in Writer.Write,关于这一条我不确定是否同样的原因

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

tang05709 commented 3 years ago

刚开始使用v1.5报这个错,我换成v3 rc2仍然报这个错 dubbo.apache.org/dubbo-go/v3 v3.0.0-rc2 github.com/apache/dubbo-go-hessian2 v1.9.2

zhaoyunxing92 commented 3 years ago

我感觉这个不应该使用uint类型吧,其他语言没有uint怎么处理?只能说使用的时候注意好了,这个问题应该之前讨论过

tang05709 commented 3 years ago

protobuf 数据类型double、float、int32、int64、uint32、uint64、sint32、sint64、fixed32、fixed64、sfixed32、sfixed64、bool、string、bytes对应共的float64、float32、int32、int64、uint32、uint64、int32、int64、uint32、uint64、int32、int64、bool、string、[]byte