-
Notifications
You must be signed in to change notification settings - Fork 929
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
go客户端设置了接口超时时间,在java 服务端无法获取到正确的值 #2546
Comments
进一步调试发现,在hessian.go中的marshalRequest方法中,对时间做了处理 func marshalRequest(encoder *hessian.Encoder, p DubboPackage) ([]byte, error) {
service := p.Service
request := EnsureRequestPayload(p.Body)
_ = encoder.Encode(DEFAULT_DUBBO_PROTOCOL_VERSION)
_ = encoder.Encode(service.Path)
_ = encoder.Encode(service.Version)
_ = encoder.Encode(service.Method)
args, ok := request.Params.([]interface{})
if !ok {
logger.Infof("request args are: %+v", request.Params)
return nil, perrors.Errorf("@params is not of type: []interface{}")
}
types, err := GetArgsTypeList(args)
if err != nil {
return nil, perrors.Wrapf(err, " PackRequest(args:%+v)", args)
}
_ = encoder.Encode(types)
for _, v := range args {
_ = encoder.Encode(v)
}
request.Attachments[PATH_KEY] = service.Path
request.Attachments[VERSION_KEY] = service.Version
if len(service.Group) > 0 {
request.Attachments[GROUP_KEY] = service.Group
}
if len(service.Interface) > 0 {
request.Attachments[INTERFACE_KEY] = service.Interface
}
if service.Timeout != 0 {
request.Attachments[TIMEOUT_KEY] = strconv.Itoa(int(service.Timeout / time.Millisecond))
}
err = encoder.Encode(request.Attachments)
return encoder.Buffer(), err
} 当timeout不等于0时,将timeout除以了time.Millisecond,但是在dubbo_invoker.go的getTimeout中,已经将时间处理成存入到attachment中
最终导致timeout被缩小了1000000倍,变成了0,将上述方法中的两处Milliseconds()更改成Nanoseconds(),测试timeout获取正常 |
We would be appreciated if you could help to submit a PR to resolve this issue. If not, I would fix this bug. |
Please remember to backport to the main branch once fixed. |
I have submit a PR, please check and verify, thanks |
Yeah, we need to move |
hessian最开始的实现中为什么要做 |
我看了一下提交记录,dubbo_invoker.go从四年前添加getTimeout方法时就做了转换成millisecond的处理,而hession从3年前创建的时候就做了 |
这个问题,使用dubbo-go的3.0.5版本经常出现,有没有解决掉,在哪一个版本修复了呢?? |
Environment
Issue description
go cliend调用java server的dubbo server,可以成功调用,但是go client接收到的时超时响应,设置了超时时间也无效,经调试,发现go client发送请求时,invocation的attachment里是设置了超时时间的,如下图
但是java server端的org.apache.dubbo.rpc.filter.ProfilerServerFilter类中的dumpIfNeed方法中,从invocation的attachement获取timeout的值是0,如下图
Logs
Click me to check logs
The text was updated successfully, but these errors were encountered: