Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo3.3.0 ,JDK 1.8 ,MacOs15.1

Steps to reproduce this issue

@GetMapping("/full_user")
public User getFullUser(@RequestHeader(value = "X-Dubbo-Proxy", required = false) String proxy) {
    long start = System.currentTimeMillis();
    User user = userService.getFullTextUser().setCtoPMillis(System.currentTimeMillis() - start);
    User objectUser = User.createFullTestUser();
    System.err.println(user);
    System.out.println(objectUser);
    User.RpcValidationResult rpcValidationResult = user.validateRpcTransmission(objectUser);
    System.out.println("============>" + rpcValidationResult);
    return user;
}

测试通过rpc 调用获取user(生产者也是通过createFullTestUser()初始化一个对象返回),和本地初始化的内容一致。 default User getFullTextUser() { User fullTestUser = User.createFullTestUser(); System.out.println(fullTestUser); return fullTestUser; }

What you expected to happen

结果返回基础类型单精度数值对不上:===>RpCValidationResult{success=false,message='RPC传输存在差异, 不一致的字段:shortValue: 7864 != 327,floatValue: 3.6893488E19 != 3.14

Anything else

看起来不像是精度丢失的问题,值偏差还较大

Are you willing to submit a pull request to fix on your own?

  • [ ] Yes I am willing to submit a pull request on my own!

Code of Conduct

Comment From: jockercheng91

修改序列化协议fastjson2 正常

Comment From: EarthChen

Please submit the issue to the hessian repository

Comment From: jockercheng91

dubbo2.x 使用hessian2 无问题。dubbo3 在默认hessian序列化协议上是否做了调整

Comment From: RainYuY

I have reproduced the issue with the float type. Please give priority to using wrapper types or double for serialization, rather than using float directly.

Comment From: zrlw

@jockercheng91 may you provide full codes that could reproduce this issue, especially the incorrect shortValue ?

Comment From: zrlw

dubbo2.x 使用hessian2 无问题。dubbo3 在默认hessian序列化协议上是否做了调整

There are a type issue at float deserialization in the hessian lite of dubbo3, but i couldn't reproduce incorrect shortValue issue which you said above, could you provide the whole sample codes which could show your incorrect shortValue issue?

Comment From: jockercheng91

I have verified the fixed commit code. The main issue is the float deserialization problem. There may be mutual influences in the serialization of primitive type data. When an object has a float-type field earlier and a serialization issue occurs, if there are subsequent char or short-type fields, they will also have value mismatches. After the float-type issue is fixed, both short and char types work properly