[apache/dubbo]provider使用triple协议时,consumer获取不到metadata,修改为dubbo协议时可以正常获取

2023-12-20 732 views
6
Environment
  • Dubbo version: 3.1.7
  • Operating System version: centos 7.6.1810
  • Java version: 1.8.0_212
Steps to reproduce this issue
  1. provider为tri时获取不到metadata
  2. 修改为dubbo时正常
Actual Behavior

报错日志

2023-03-04 10:06:23  [ Dubbo-framework-SD-address-refresh-0-thread-1:53010625 ] - [ INFO ] org.apache.dubbo.rpc.model.ModuleModel.registerInternalConsumer(ModuleModel.java:196)  [DUBBO] Dynamically registering consumer model A/org.apache.dubbo.metadata.MetadataService:1.0.0 into model Dubbo Module[1.1.0], dubbo version: 3.1.7, current host: YYY
2023-03-04 10:06:26  [ Dubbo-framework-SD-address-refresh-0-thread-1:53013627 ] - [ ERROR ]   [DUBBO] Failed to get app metadata for revision ***11b4a9a545f7 for type local from instance XXX:21779, dubbo version: 3.1.7, current host: YYY, error code: 1-39. This may be caused by , go to https://dubbo.apache.org/faq/1/39 to find instructions. 
org.apache.dubbo.rpc.RpcException: Fail to invoke remote method: getMetadataInfo, provider: tri://XXX:21779/org.apache.dubbo.metadata.MetadataService?connections=1&corethreads=2&dubbo=2.0.2&group=A&port=21779&protocol=tri&release=3.1.7&retries=0&side=provider&threadpool=cached&threads=100&timeout=5000&version=1.0.0, cause: org.apache.dubbo.rpc.StatusRpcException: UNAVAILABLE : upstream XXX:21779 is unavailable
    at org.apache.dubbo.rpc.protocol.AbstractInvoker.waitForResultIfSync(AbstractInvoker.java:281)
    at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:186)
    at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:71)
    at org.apache.dubbo.rpc.proxy.InvocationUtil.invoke(InvocationUtil.java:57)
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:75)
    at org.apache.dubbo.metadata.MetadataServiceDubboProxy10.getMetadataInfo(MetadataServiceDubboProxy10.java)
    at org.apache.dubbo.registry.client.metadata.MetadataUtils.getRemoteMetadata(MetadataUtils.java:173)
    at org.apache.dubbo.registry.client.AbstractServiceDiscovery.getRemoteMetadata(AbstractServiceDiscovery.java:228)
    at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.lambda$doOnEvent$2(ServiceInstancesChangedListener.java:159)
    at java.util.Optional.orElseGet(Optional.java:267)
    at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.doOnEvent(ServiceInstancesChangedListener.java:159)
    at org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener.onEvent(ServiceInstancesChangedListener.java:113)
    at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscoveryChangeWatcher$1.lambda$doNotify$0(ZookeeperServiceDiscoveryChangeWatcher.java:71)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscoveryChangeWatcher$1.doNotify(ZookeeperServiceDiscoveryChangeWatcher.java:71)
    at org.apache.dubbo.registry.RegistryNotifier$NotificationTask.run(RegistryNotifier.java:106)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.rpc.StatusRpcException: UNAVAILABLE : upstream XXX:21779 is unavailable
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
    at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:196)
    at org.apache.dubbo.rpc.protocol.AbstractInvoker.waitForResultIfSync(AbstractInvoker.java:266)
    ... 22 more
Caused by: org.apache.dubbo.rpc.StatusRpcException: UNAVAILABLE : upstream XXX:21779 is unavailable
    at org.apache.dubbo.rpc.TriRpcStatus.asException(TriRpcStatus.java:214)
    at org.apache.dubbo.rpc.protocol.tri.TripleInvoker.doInvoke(TripleInvoker.java:105)
    at org.apache.dubbo.rpc.protocol.AbstractInvoker.doInvokeAndReturn(AbstractInvoker.java:222)
    at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:183)
    ... 21 more

调试截图 org.apache.dubbo.rpc.protocol.tri.TripleInvoker#doInvoke->org.apache.dubbo.remoting.api.Connection#isAvailable image

image

回答

9

@EarthChen PTAL

0

你那里必现吗?能提供一个 demo 方便我们复现一下吗?

2

现在我这边复现不了了,全部服务都回退到dubbo协议了

是2.7.3升级到3.1.7过程中发现的问题 升级过程:升级依赖->修改服务发现模型为instance->修改协议为tri

2

那我理解一下你是回到了2.x 不会吗?还是说3.1.7的 dubbo 协议使用应用级发现

4

是后者,只是回退了协议

6

这个问题我遇到了 解决方法是在provider的pom或者gradle里添加org.apache.dubbo:dubbo-rpc-triple:3.2.0-beta.5 在provider的application里dubbo.protocol.name=tri,在consumer里dubbo.consumer.protocol=tri

2

那说明3.1的tri协议还是有点问题,暂时先不折腾了,等3.2release后升3.2,感谢回复?

5

这个问题有可能是在升级后没有添加 dubbo-rpc-triple 这个包导致的,我之前测试的时候没有加这个包consumer就会报类似这个问题,同时prodiver也会报一个错误。而使用dubbo协议就没有问题。 consumer端会报: invocation context: 2023-06-16T05:06:14.176468303Z timeout=5000; 2023-06-16T05:06:14.176522304Z group=dubbo-provider; 2023-06-16T05:06:14.176569704Z thread info: 2023-06-16T05:06:14.176625005Z Start time: 13001516656092 2023-06-16T05:06:14.176684706Z +-[ Offset: 0.000000ms; Usage: 5010.949001ms, 100% ] Receive request. Client invoke begin. ServiceKey: dubbo-provider/org.apache.dubbo.metadata.MetadataService:1.0.0 MethodName:getMetadataInfo, dubbo version: 3.1.8, current host: 172.17.0.4, error code: 3-4. This may be caused by , go to https://dubbo.apache.org/faq/3/4 to find instructions. 2023-06-16T05:06:14.181383383Z 2023-06-16 05:06:14.180 ERROR 1 --- [ main] o.a.d.r.client.metadata.MetadataUtils : [DUBBO] Failed to get app metadata for revision 5a8e40c3ff757148209bcc5b4ddfc815 for type local from instance 172.17.0.3:50051, dubbo version: 3.1.8, current host: 172.17.0.4, error code: 1-39. This may be caused by , go to https://dubbo.apache.org/faq/1/39 to find instructions. 2023-06-16T05:06:14.181481785Z 2023-06-16T05:06:14.181550886Z org.apache.dubbo.rpc.StatusRpcException: DEADLINE_EXCEEDED : Waiting server-side response timeout by scan timer. start time: 2023-06-16 05:06:09.171, end time: 2023-06-16 05:06:14.175, timeout: 5000 ms, service: org.apache.dubbo.metadata.MetadataService, method: getMetadataInfo

provider端会报找不到类Caused by: java.lang.ClassNotFoundException: com.google.protobuf.Message