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

ExtensionLoader 加载重复 filter,出现 Duplicate extension 被 exceptions 获取后却不抛出来 #4340

Closed
1 of 2 tasks
masteryourself opened this issue Jun 18, 2019 · 3 comments · Fixed by #5072
Closed
1 of 2 tasks
Assignees
Milestone

Comments

@masteryourself
Copy link

masteryourself commented Jun 18, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.6.5
  • Operating System version: win10
  • Java version: 1.8

Steps to reproduce this issue

  1. dubbo spi 扩展列表有 exception=com.alibaba.dubbo.rpc.filter.ExceptionFilter
  2. 我自己实现了一个 filter 扩展,名为 exception=xxxFilter
  3. debug com.alibaba.dubbo.common.extension.ExtensionLoader#loadClass 将抛出 throw new IllegalStateException("Duplicate extension "......)

Expected Result

此异常被 exceptions 获取后,不抛出来,理论上不应该抛出来给用户吗,否则将被加载 jar 包的顺序影响,如果在 dubbo 生效之前加载,自己的 filter 就起作用,否则不起作用

Actual Result

捕获异常后没有任何提示信息

@cvictory
Copy link
Contributor

cvictory commented Jun 19, 2019

I think this is a issue we should improve.

Can you post a pr for this issue?

@cvictory cvictory added this to the 2.7.4 milestone Jun 19, 2019
@masteryourself
Copy link
Author

ok, tonight or tomorrow

@manzhizhen
Copy link

Hello, I looked at your PR. The basic idea is to throw an exception when loading an extension point with the same name but different types, but I still have some objections to this PR. First, you will use it. What is the extension point name already used inside a dubbo? Second, if you have a conflicting extension point name, the class loading order cannot be determined, so it may be loaded into your own Filter, but is it really necessary to throw an exception? For example, when the same class loader loads a class, it is mainly loaded first. Even if there is another identical class, it is ignored by default. Do you really need to throw an exception?

你好,我看了下你的PR,基本的思路是希望当加载到相同名称但类型不同的扩展点时,抛异常出来,但我对这个PR还是有些异议,第一,为啥你会用一个dubbo内部已经使用的扩展点名称?第二,假如你起了一个冲突的扩展点名称,类加载顺序不能确定,所以有可能是加载到你自己的Filter,但是否真需要抛异常吗?比如同一个类加载器加载类时,以先加载的为主,哪怕有另一个相同的class,默认它也是忽略,真的需要抛异常吗?

如果有时间我们可以电话沟通下:18668225833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment