apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.44k stars 26.42k forks source link

广播收集功能不可用 #8601

Closed eye-gu closed 1 year ago

eye-gu commented 3 years ago

广播收集报错,查看 BroadcastCluster2Invoker 代码,发现在实现 whenCompleteWithContext 方法的时候,又重新实例化了一个不支持 whenCompleteWithContext 方法的AppResponse对象返回,导致抛出 UnsupportedOperationException("AppResponse represents an concrete business response, there will be no status changes, you should get internal values directly.") 异常。此处不应实例化新的对象,直接返回 this 即可。

changfubai commented 3 years ago

请说明一下对应的版本

eye-gu commented 3 years ago

2.7.12

eye-gu commented 3 years ago

还发现在广播收集时,如果是动态token,会出现token异常.debug TokenFilter,发现调用多个invoker时token是其中的一个,没有每次都随着invoker不同而修改

kaori-seasons commented 2 years ago

@CrazyHZM I will try to reproduce the whole problem, please assign him to me

kaori-seasons commented 2 years ago

@ououtt @CrazyHZM Is it consistent with the broadcast instance reproduced here? https://github.com/complone/dubbo/tree/dubbo3-demo

kaori-seasons commented 2 years ago

But there is no error, so it has been enhanced

LovingCoder commented 1 year ago

我没有找到最终的解决方案,有知道怎么解决的朋友吗?

eye-gu commented 1 year ago

@LovingCoder 当初我是重写了BroadcastCluster2Invoker,然后使用自定义的token来绕过去的。最新版本不知道解决没有

LovingCoder commented 1 year ago

现在新发的3.0+版本,好像已经移除BroadcastCluster2Invoker了。好像官方也没有给出明确的解决方法。我的需求是可以调用到一个interface在同一个group的所有实现类,不区分tag,我在实际测试中发现,broadcast只能调用到同一个tag下的provider,你遇到了这个问题吗?有没有什么好的解决方案呢?

LovingCoder commented 1 year ago

我目前使用的版本是2.7.15

eye-gu commented 1 year ago

tag路由和广播,这两个我没一起用,找官方确认一下吧

LovingCoder commented 1 year ago

嗯,我看社区的开发者好像也不处理这个issue了,源码中有个选择invokers的地方,我再找一找,官方的文档我没有找到这个问题的解决办法,只能自己通过源码debug查找了,谢谢

AlbumenJ commented 1 year ago

原有 BroadcastCluster2Invoker 功能在 Dubbo 3 中可以通过依赖一下 gav 实现

<dependency>
  <groupId>org.apache.dubbo.extensions</groupId>
  <artifactId>dubbo-cluster-broadcast-1</artifactId>
  <version>1.0.0</version>
</dependency>

如果有需要修改的可以提交到这里,合并后社区会进行发版

https://github.com/apache/dubbo-spi-extensions/blob/master/dubbo-cluster-extensions/dubbo-cluster-broadcast-1/src/main/java/org/apache/dubbo/rpc/cluster/support/BroadcastCluster1Invoker.java

LovingCoder commented 1 year ago

很感谢开发者的回复,我们目前使用的是 spring-cloud-starter-dubbo 2021.0.1.0版本,里面的dubbo版本是2.7.15,这个解决方案估计用不上。在2.7.15版本中,使用broadcast调用,实际测试中发现只能调用同一个tag下的provider,这是我参考的文档链接https://dubbo.apache.org/zh/docsv2.7/user/examples/broadcast-resp-collect/

CrazyHZM commented 1 year ago

If you still have problems, you can reopen the issue.

yellowsand1 commented 6 months ago

好好好 我也遇到了 我选择直接重写。。。顺便还有解决里面的空指针那个问题

yangfeng20 commented 1 month ago

很感谢开发者的回复,我们目前使用的是 spring-cloud-starter-dubbo 2021.0.1.0版本,里面的dubbo版本是2.7.15,这个解决方案估计用不上。在2.7.15版本中,使用broadcast调用,实际测试中发现只能调用同一个tag下的provider,这是我参考的文档链接https://dubbo.apache.org/zh/docsv2.7/user/examples/broadcast-resp-collect/

你好,你这个链接访问被重定向了。文档没了。我想在碰到了一样的问题。就是在我有多个实例的情况下,加了@Reference(cluster = "broadcast", check = false) 使用广播模式。但是仅有一个实例的方法被调用。更离谱的是,我通过arthas 的sc 没有搜索到org.apache.dubbo.rpc.cluster.support.BroadcastClusterInvoker类,但是源代码中是有的。我不清楚为什么没有广播。同时想请教您说的同一个tag是什么,@Reference上面的tag吗,但是我并没有设置过tag。