Skip to content
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

RMI协议同一个服务提供者中,分组和版本不起作用 #9913

Closed
12482 opened this issue Apr 12, 2022 · 4 comments
Closed

RMI协议同一个服务提供者中,分组和版本不起作用 #9913

12482 opened this issue Apr 12, 2022 · 4 comments
Labels
type/bug Bugs to being fixed

Comments

@12482
Copy link

12482 commented Apr 12, 2022

系统版本

  • Dubbo version: 2.7.15
  • Java version: 1.8

问题出现的步骤

  1. dubbo客户端和服务端采用RMI协议交互
  2. 在服务端某个接口有两个实现类,他们版本相同,标记成不同的组: g1, g2
  3. 在客户端,无论调用哪个组,最终都会调用到g2这个一个组的接口
  4. 同样的,服务端两个某一接口两个实现类标记成不同的版本,在客户端分别调用不同版本的接口,最终也会定位到服务端的同一个版本
@12482 12482 added the type/bug Bugs to being fixed label Apr 12, 2022
@xielongfei
Copy link

我看了相关代码,存在你说的版本、分组无效问题。

原因在于RMI 绑定到Registry注册表时name(远程引用对象关联的名称)不能重复,如果重复会报AlreadyBoundException异常。dubbo-rpc-rmi模块中用的RmiServiceExporter对象完成绑定操作,其replaceExistingBinding属性默认为true,所以会调用rebind方法进行重绑定,name相同会覆盖。

目前dubbo中绑定的name值是接口全限定名,未包含分组和版本标识。
例如:rebind(org.apache.dubbo.demo.DemoService, obj);
如果加上分组和版本值:rebind(g1/org.apache.dubbo.demo.DemoService:v1,obj),则name唯一,Consumer远程调用时会找到指定的存根对象进行调用。

本地已测可行。我在RmiProtocol类中调整了doRefer()、createExporter()代码后,版本和分组已生效。

但我切换3.0.7分支后,发现dubbo-rpc-rmi相关模块已移除。所以我不清楚这是不是bug。

@12482
Copy link
Author

12482 commented Apr 20, 2022

我看了相关代码,存在你说的版本、分组无效问题。

原因在于RMI 绑定到Registry注册表时name(远程引用对象关联的名称)不能重复,如果重复会报AlreadyBoundException异常。dubbo-rpc-rmi模块中用的RmiServiceExporter对象完成绑定操作,其replaceExistingBinding属性默认为true,所以会调用rebind方法进行重绑定,name相同会覆盖。

目前dubbo中绑定的name值是接口全限定名,未包含分组和版本标识。 例如:rebind(org.apache.dubbo.demo.DemoService, obj); 如果加上分组和版本值:rebind(g1/org.apache.dubbo.demo.DemoService:v1,obj),则name唯一,Consumer远程调用时会找到指定的存根对象进行调用。

本地已测可行。我在RmiProtocol类中调整了doRefer()、createExporter()代码后,版本和分组已生效。

但我切换3.0.7分支后,发现dubbo-rpc-rmi相关模块已移除。所以我不清楚这是不是bug。

调整doRefer()、createExporter()我在本地也尝试过,基本功能没问题,但是不确定是否会带来其他影响,dubbo2.7 是否还会有相关的补丁发布呢,dubbo3的rmi协议应该是要重新适配 https://github.com/apache/dubbo/issues/7781,

@CrazyHZM
Copy link
Member

Thanks for your feedback.
The 2.7.x version can still be patched in the master branch in this repository, and the latest version 3.x has moved the rmi protocol to the following projects:
https://github.com/apache/dubbo-spi-extensions
You can patch this project in this project.

xielongfei pushed a commit to xielongfei/dubbo that referenced this issue Apr 21, 2022
xielongfei pushed a commit to xielongfei/dubbo that referenced this issue Apr 21, 2022
xielongfei added a commit to xielongfei/dubbo that referenced this issue Apr 22, 2022
@xielongfei
Copy link

Thanks for your feedback. The 2.7.x version can still be patched in the master branch in this repository, and the latest version 3.x has moved the rmi protocol to the following projects: https://github.com/apache/dubbo-spi-extensions You can patch this project in this project.

I submitted a pr, please check, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

3 participants