dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

InjvmInvoker throw Exception that message is "No Provider ..." with consumer refer DubboService use "*"

Open saleson opened this issue 1 year ago • 5 comments

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

Environment

  • Dubbo version: 3.1.6
  • Operating System version: mac 12.6
  • Java version: 1.8

Steps to reproduce this issue

  1. two providers export injvm DubboService : com.test.TestService:1.0.0 and com.test.TestService
  2. consumer refer injvm DubboService: com.test.TestService:*
  3. consumer call DubboService com.test.TestService.test()

Pls. provide [GitHub address] to reproduce this issue.

Expected Behavior

consumer call provider success.

Actual Behavior

throw Exception and the message is "No Provider".

If there is an exception, please attach the exception trace:

Just put your stack trace here!

saleson avatar Jan 31 '24 10:01 saleson

This seem that we need to support group merge for injvm protocol?

AlbumenJ avatar Jan 31 '24 16:01 AlbumenJ

It support group, but InjvmInvoker.isAvailable() is not support the wildcard ("*"), because the code logic of InjvmInvoker.isAvailable() is inconsistent with InjvmInvoker.doInvoke(). the code of InjvmInvoker.isAvailable() :

public boolean isAvailable() {
        InjvmExporter<?> exporter = (InjvmExporter)this.exporterMap.get(this.key);
        return exporter == null ? false : super.isAvailable();
    }

the code of InjvmInvoker.doInvoke():

public Result doInvoke(Invocation invocation) throws Throwable {
        Exporter<?> exporter = InjvmProtocol.getExporter(this.exporterMap, this.getUrl());
        if (exporter == null) {
            throw new RpcException("Service [" + this.key + "] not found.");
        } else {
           ...
        }
}

PR https://github.com/apache/dubbo/pull/13716 is fix it. please

saleson avatar Feb 02 '24 01:02 saleson

It support group, but InjvmInvoker.isAvailable() is not support the wildcard ("*"), because the code logic of InjvmInvoker.isAvailable() is inconsistent with InjvmInvoker.doInvoke(). the code of InjvmInvoker.isAvailable() :

public boolean isAvailable() {
        InjvmExporter<?> exporter = (InjvmExporter)this.exporterMap.get(this.key);
        return exporter == null ? false : super.isAvailable();
    }

the code of InjvmInvoker.doInvoke():

public Result doInvoke(Invocation invocation) throws Throwable {
        Exporter<?> exporter = InjvmProtocol.getExporter(this.exporterMap, this.getUrl());
        if (exporter == null) {
            throw new RpcException("Service [" + this.key + "] not found.");
        } else {
           ...
        }
}

PR #13716 is fix it. please

I think we should create a directory for it like those provider registered in registry.

AlbumenJ avatar Feb 02 '24 06:02 AlbumenJ

e.g. org.apache.dubbo.registry.integration.RegistryDirectory#toMergeInvokerList

AlbumenJ avatar Feb 02 '24 06:02 AlbumenJ

It support group, but InjvmInvoker.isAvailable() is not support the wildcard ("*"), because the code logic of InjvmInvoker.isAvailable() is inconsistent with InjvmInvoker.doInvoke(). the code of InjvmInvoker.isAvailable() :

public boolean isAvailable() {
        InjvmExporter<?> exporter = (InjvmExporter)this.exporterMap.get(this.key);
        return exporter == null ? false : super.isAvailable();
    }

the code of InjvmInvoker.doInvoke():

public Result doInvoke(Invocation invocation) throws Throwable {
        Exporter<?> exporter = InjvmProtocol.getExporter(this.exporterMap, this.getUrl());
        if (exporter == null) {
            throw new RpcException("Service [" + this.key + "] not found.");
        } else {
           ...
        }
}

PR #13716 is fix it. please

I think we should create a directory for it like those provider registered in registry.

goods idea, we should support it for consumer refer use wildcard either on "group" or "version" or both in the best.

saleson avatar Feb 02 '24 10:02 saleson