sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.81k stars 1.17k forks source link

bugfix: Compatible with Protobuf empty object. #1376

Open imangry opened 7 months ago

imangry commented 7 months ago

Motivation:

When sending or returning a Protobuf empty object with a content length of 0,just like PagePB.Response.getDefaultInstance(), the client or server will report an error. This modification will be compatible with this situation.

03:03:00.363 [SOFA-SEV-BOLT-BIZ-12200-3-T2] ERROR c.a.s.r.c.bolt.SofaRpcSerialization - traceId=null, rpcId=null, Request deserializeContent exception, msg=Content of request is null
com.alipay.remoting.exception.DeserializationException: Content of request is null
    at com.alipay.sofa.rpc.codec.bolt.SofaRpcSerialization.deserializeContent(SofaRpcSerialization.java:273)
    at com.alipay.remoting.rpc.protocol.RpcRequestCommand.deserializeContent(RpcRequestCommand.java:148)
    at com.alipay.remoting.rpc.RpcCommand.deserialize(RpcCommand.java:117)
    at com.alipay.remoting.rpc.RpcCommand.deserialize(RpcCommand.java:138)
    at com.alipay.remoting.rpc.protocol.RpcRequestProcessor.deserializeRequestCommand(RpcRequestProcessor.java:286)
    at com.alipay.remoting.rpc.protocol.RpcRequestProcessor.doProcess(RpcRequestProcessor.java:143)
    at com.alipay.remoting.rpc.protocol.RpcRequestProcessor$ProcessTask.run(RpcRequestProcessor.java:393)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1623)
Exception in thread "main" com.alipay.sofa.rpc.core.exception.SofaRpcException: Failed to call org.apache.dubbo.benchmark.bean.UserServiceDubbo$IUserService.createUser on remote server bolt://127.0.0.1:12200, return null
    at com.alipay.sofa.rpc.client.FailoverCluster.doInvoke(FailoverCluster.java:81)
    at com.alipay.sofa.rpc.client.AbstractCluster.invoke(AbstractCluster.java:298)
    at com.alipay.sofa.rpc.client.ClientProxyInvoker.invoke(ClientProxyInvoker.java:83)
sofastack-cla[bot] commented 7 months ago

Hi @imangry, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 72.02%. Comparing base (1e99afb) to head (818b533). Report is 13 commits behind head on master.

Files Patch % Lines
...ipay/sofa/rpc/codec/bolt/SofaRpcSerialization.java 66.66% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1376 +/- ## ========================================== Coverage 72.01% 72.02% - Complexity 784 795 +11 ========================================== Files 416 422 +6 Lines 17661 17813 +152 Branches 2752 2768 +16 ========================================== + Hits 12719 12830 +111 - Misses 3538 3574 +36 - Partials 1404 1409 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.