apache / dubbo-go

Go Implementation For Apache Dubbo .
https://dubbo.apache.org/
Apache License 2.0
4.67k stars 910 forks source link

Java interoperability issue, `go-client` call `java-server` failed when calling MetadataService during service discovery. #2653

Closed chickenlj closed 6 days ago

chickenlj commented 3 months ago

How to produce:

  1. demo repo
  2. start java-server
  3. start go-client

Then the following error occurs:

2024-04-05 18:32:42     INFO    servicediscovery/service_instances_changed_listener_impl.go:102 Received instance notification event of service greet-java-server, instance list size %!s(int=1)
panic: reflect: call of reflect.Value.MethodByName on zero Value

goroutine 1 [running]:
reflect.Value.MethodByName({0x0?, 0x0?, 0x140003d1f80?}, {0x101988e8e?, 0x0?})
        /Users/ken/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.1.darwin-arm64/src/reflect/value.go:2112 +0x114
github.com/dubbogo/triple/pkg/triple.getInvoker({0x0?, 0x0?}, 0x12?)
        /Users/ken/go/pkg/mod/github.com/dubbogo/triple@v1.2.2-rc3/pkg/triple/dubbo3_conn.go:79 +0x104
github.com/dubbogo/triple/pkg/triple.NewTripleClient({0x0, 0x0}, 0x101e33f40?)
        /Users/ken/go/pkg/mod/github.com/dubbogo/triple@v1.2.2-rc3/pkg/triple/dubbo3_client.go:117 +0x708
dubbo.apache.org/dubbo-go/v3/protocol/triple.NewDubbo3Invoker(0x140008b2700)
        /Users/ken/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.2.0-rc1/protocol/triple/dubbo3_invoker.go:128 +0x888
dubbo.apache.org/dubbo-go/v3/protocol/triple.(*TripleProtocol).Refer(0x140008c24b0, 0x140008b2700)
        /Users/ken/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.2.0-rc1/protocol/triple/triple.go:117 +0x58
dubbo.apache.org/dubbo-go/v3/metadata/service/local.createProxy({0x102204780, 0x140004012c0})
        /Users/ken/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.2.0-rc1/metadata/service/local/metadata_service_proxy_factory.go:69 +0x124
dubbo.apache.org/dubbo-go/v3/metadata/service.(*BaseMetadataServiceProxyFactory).GetProxy(0x10198174a?, {0x102204780?, 0x140004012c0?})
        /Users/ken/go/pkg/mod/dubbo.apache.org/dubbo-go/v3@v3.2.0-rc1/metadata/service/local_service.go:119 +0x34

I think the problem happened when go-client tries to call MetadataService. But it's strange that it wants to call GetDubboStub method , that's only available when using Protobuf, but obviously in current version, MetadataService is not from Protobuf.

image

FoghostCn commented 3 months ago

demo is 404, it looks like your java server use triple protocol for metadata service, but now we only support dubbo protocol

cnmac commented 1 week ago

Has anyone dealt with this issue? I've encountered this as well.

FoghostCn commented 6 days ago

ref https://github.com/apache/dubbo-go/issues/2403

FoghostCn commented 6 days ago

in fact dubbo java metadataService use the same protocol with user's config unless you config it manually,it means in java-server it use tri as metadata service protocol,but dubbo-go not support tri protocol in metadata service,that's the problem

in java server side,set dubbo.application.metadataServiceProtocol=dubbo to make it work;

FoghostCn commented 6 days ago

fixed in https://github.com/apache/dubbo-go-samples/pull/777